# Programmable filter script path

**URL:** https://discourse.paraview.org/t/programmable-filter-script-path/4558
**Category:** ParaView Support
**Created:** [June 11, 2020, 1:12am UTC](https://discourse.paraview.org/t/programmable-filter-script-path/4558 "2020-06-11T01:12:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Mahdi\_Kooshkbaghi](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mahdi_kooshkbaghi/32/3669_2.png) [@Mahdi\_Kooshkbaghi](https://discourse.paraview.org/u/Mahdi_Kooshkbaghi)
#### Post date: [June 11, 2020, 1:12am UTC](https://discourse.paraview.org/t/programmable-filter-script-path/4558/1 "2020-06-11T01:12:41Z")

</div>

Hi all,

I have a script as follows:

```python
merge_data = MergeBlocks(nek3d)

# Extract selection of data for 1.0<T<7.5 in a range
#(temperature > 1.0) & (temperature < 7.5)
selection=SelectPoints()
selection.QueryString="(temperature >1.0) & (temperature <= 7.5)"
selection.FieldType = 'POINT'
selection.UpdatePipelineInformation()
mySelection = ExtractSelection(Input=merge_data, Selection=selection)
mySelection.UpdatePipeline()

# create new programmable filters
analysis = ProgrammableFilter(Input=mySelection)
analysis.Script = """
import numpy as np
import numpy.linalg as nl
from paraview import numpy
.
.
.

```

The script works fine.  
However, the `analysis` script is so long and I prefer to have it in the separate (python) file for readability purposes.  
Something like

```python
analysis.Script('path_to_the_file')

```

Is it possible to do that?

Thanks in advance

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 11, 2020, 2:20am UTC](https://discourse.paraview.org/t/programmable-filter-script-path/4558/2 "2020-06-11T02:20:41Z")

</div>

You should be able to read your script, dump it into a string and pass it as an argument.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 11, 2020, 2:21am UTC](https://discourse.paraview.org/t/programmable-filter-script-path/4558/3 "2020-06-11T02:21:18Z")

</div>

That being said, it would be nice to provide a file based api for the programmable filter.

---

<div class="post-metadata">

### Author: ![Mahdi\_Kooshkbaghi](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mahdi_kooshkbaghi/32/3669_2.png) [@Mahdi\_Kooshkbaghi](https://discourse.paraview.org/u/Mahdi_Kooshkbaghi)
#### Post date: [June 11, 2020, 2:26am UTC](https://discourse.paraview.org/t/programmable-filter-script-path/4558/4 "2020-06-11T02:26:52Z")

</div>

Thanks. But what is the argument?  
Something like

```python
analysis.Script('./analysis.py')

```

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [June 11, 2020, 2:31am UTC](https://discourse.paraview.org/t/programmable-filter-script-path/4558/5 "2020-06-11T02:31:20Z")

</div>

Maybe I misexplained.

You need to read the file yourself using standard python file reading tools (open, file.read, …), then store the content into a string that will be passed as an argument.
