# Is it possible to use a custom filter from pvpython?

**URL:** https://discourse.paraview.org/t/is-it-possible-to-use-a-custom-filter-from-pvpython/2293
**Category:** ParaView Support
**Created:** [July 25, 2019, 3:03am UTC](https://discourse.paraview.org/t/is-it-possible-to-use-a-custom-filter-from-pvpython/2293 "2019-07-25T03:03:29Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![william](https://discourse.paraview.org/user_avatar/discourse.paraview.org/william/32/1800_2.png) [@william](https://discourse.paraview.org/u/william)
#### Post date: [July 25, 2019, 3:03am UTC](https://discourse.paraview.org/t/is-it-possible-to-use-a-custom-filter-from-pvpython/2293/1 "2019-07-25T03:03:29Z")

</div>

Hi,  
I have created a very long python script from a trace. Unfortunately I used a custom filter, so the trace took it as a function. Now, if I want to re-run the script generated by the trace, I get the error that pvpython does not know anything about the custom filter. Is there a way to load the custom filter into pvpython? In the trace script the custom filter is a function, so I tried to look for a file to import without any success. I tried looking for a file called as the custom filter but did not find it anywhere and the only file with something related is the file ~/.config/ParaView/ParaView5.6.0.ini where the custom filter is mentioned but I don’t see how to use the info there into the trace script. BTW, I am using Mac Os X Mojave with Paraview 5.6.0.  
Thnkas 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: [July 25, 2019, 7:01am UTC](https://discourse.paraview.org/t/is-it-possible-to-use-a-custom-filter-from-pvpython/2293/2 "2019-07-25T07:01:08Z")

</div>

Programmable filter are supported in python script.

> Unfortunately I used a custom filter, so the trace took it as a function.

What do you mean by that ?

Could you explain how did you manage to obtain an unusable python script ?

---

<div class="post-metadata">

### Author: ![william](https://discourse.paraview.org/user_avatar/discourse.paraview.org/william/32/1800_2.png) [@william](https://discourse.paraview.org/u/william)
#### Post date: [July 26, 2019, 1:42am UTC](https://discourse.paraview.org/t/is-it-possible-to-use-a-custom-filter-from-pvpython/2293/3 "2019-07-26T01:42:39Z")

</div>

Hello,  
Regarding your questions:

- Custom filter as a function: At least in the trace I get, a custom filter looks like a function call. Example: My filter is called spheres. Here is the code that appears in the trace when I use the custom filter:  
`# create a new 'spheres'`  
`spheres1 = spheres(Input=packing_initialvtp)`

- How I managed to obtain an unusable script : Well, I just used the trace function and a custom filter, and since a custom filter is a function call, when I try to run the trace script with pvpython the interpreter does not know where that function (the custom filter) is defined, so that throws an error. I am attaching the script generated by the trace. It just opens a file and then applies the custom filter. As you can see, there is no declaration of the function spheres (that is, the custom filter) .  
[example.py](https://discourse.paraview.org/uploads/short-url/bt8hfkaYetPyS1647YDcaCl8FMH.py) (4.6 KB)

So my original question remains: How do I use a custom filter with pvpython? Should I include some special path? should I export the custom filter as a python script (currently it looks than I can only export it as an xml). My work around was to not use the custom filter and just use the primitive glyphs. But the question still remains.

Thanks in advance

Edit: formatting

---

<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: [July 26, 2019, 7:28am UTC](https://discourse.paraview.org/t/is-it-possible-to-use-a-custom-filter-from-pvpython/2293/4 "2019-07-26T07:28:46Z")

</div>

Looks like using CustomFilter in pvpython is not supported sadly. This is an usability bug imo.

Am I mistaken @utkarsh.ayachit ?

---

<div class="post-metadata">

### Author: ![SCRO1022](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/s/aca169/32.png) [@SCRO1022](https://discourse.paraview.org/u/SCRO1022)
#### Post date: [January 17, 2023, 5:47pm UTC](https://discourse.paraview.org/t/is-it-possible-to-use-a-custom-filter-from-pvpython/2293/5 "2023-01-17T17:47:58Z")

</div>

I have the same issue with Paraview-5.9.1 and need help to make it work…

So the problem is, that i have created a custom filter “exampleFilter.cpd” and want to use it with pvpython/pvbatch. I added this filter via tool - manage custom filters - import and can use it now in my gui.  
But it is not known in the batch mode and on other machines.  
Is there a way to add this filter permanently? Or maybe just to include it in the python script?

Thanks!

---

<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: [January 18, 2023, 10:18am UTC](https://discourse.paraview.org/t/is-it-possible-to-use-a-custom-filter-from-pvpython/2293/6 "2023-01-18T10:18:35Z")

</div>

I dont think it changed since three years ago. You may want to open an issue: [https://gitlab.kitware.com/paraview/paraview/-/issues](https://gitlab.kitware.com/paraview/paraview/-/issues)

---

<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: [July 11, 2025, 9:05am UTC](https://discourse.paraview.org/t/is-it-possible-to-use-a-custom-filter-from-pvpython/2293/7 "2025-07-11T09:05:27Z")

</div>

[https://gitlab.kitware.com/paraview/paraview/-/issues/23018](https://gitlab.kitware.com/paraview/paraview/-/issues/23018)
