# Cannot set Scalars attribute properly in Threshold when using python script

**URL:** https://discourse.paraview.org/t/cannot-set-scalars-attribute-properly-in-threshold-when-using-python-script/12655
**Category:** ParaView Support
**Created:** [August 6, 2023, 3:31pm UTC](https://discourse.paraview.org/t/cannot-set-scalars-attribute-properly-in-threshold-when-using-python-script/12655 "2023-08-06T15:31:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Squirrel8475](https://discourse.paraview.org/user_avatar/discourse.paraview.org/squirrel8475/32/12000_2.png) [@Squirrel8475](https://discourse.paraview.org/u/Squirrel8475)
#### Post date: [August 6, 2023, 3:31pm UTC](https://discourse.paraview.org/t/cannot-set-scalars-attribute-properly-in-threshold-when-using-python-script/12655/1 "2023-08-06T15:31:41Z")

</div>

Hello Paraview team,

My pipeline contains a “Threshold” to subselect cells based on ‘vtkValidPointMask’ scalar. It works fine when built from the GUI. However, when the pipeline is built from a Python script, the Scalar is not set properly: the Scalars field remains empty as illustrated in the picture. What shall I do to set this attribute properly? All other attributes in the script are set properly.

 ![20230806_scalar_not_set](https://discourse.paraview.org/uploads/default/original/2X/f/fa0b022e512e0887784514a996547137eaac4a4f.png)

Best regards

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [August 9, 2023, 2:04pm UTC](https://discourse.paraview.org/t/cannot-set-scalars-attribute-properly-in-threshold-when-using-python-script/12655/2 "2023-08-09T14:04:54Z")

</div>

It is because the widget shows only existing arrays. But, as the pipeline didn’t run yet, no arrays are found.

You should add `UpdatePipeline()` before creating the `Threshold`.

---

<div class="post-metadata">

### Author: ![Squirrel8475](https://discourse.paraview.org/user_avatar/discourse.paraview.org/squirrel8475/32/12000_2.png) [@Squirrel8475](https://discourse.paraview.org/u/Squirrel8475)
#### Post date: [August 13, 2023, 9:13am UTC](https://discourse.paraview.org/t/cannot-set-scalars-attribute-properly-in-threshold-when-using-python-script/12655/3 "2023-08-13T09:13:07Z")

</div>

The UpdatePipeline was indeed not placed before the Threshold creation, thank you very much for the solution
