# Update ExtractSelection filter in python

**URL:** https://discourse.paraview.org/t/update-extractselection-filter-in-python/8279
**Category:** ParaView Support
**Tags:** python
**Created:** [October 28, 2021, 1:26pm UTC](https://discourse.paraview.org/t/update-extractselection-filter-in-python/8279 "2021-10-28T13:26:32Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Hugo](https://discourse.paraview.org/user_avatar/discourse.paraview.org/hugo/32/7836_2.png) [@Hugo](https://discourse.paraview.org/u/Hugo)
#### Post date: [October 28, 2021, 1:26pm UTC](https://discourse.paraview.org/t/update-extractselection-filter-in-python/8279/1 "2021-10-28T13:26:32Z")

</div>

Hello,

I’m trying to update an ExtractSelection filter in python but I can’t figure out how to make it work.

Here is an example of what I’m trying to do :

```auto
from paraview.simple import *
from paraview.selection import *

parent = GetActiveSource()
extract_sel = ExtractSelection(Input=parent)

ids = [0, 1, 2,]
selection = SelectGlobalIDs(IDs=ids, FieldType="CELL", ContainingCells=False,
                                              Source=parent, Modifier=None)

extract_sel.Selection = selection

```

My selection is only taken into account if I give it at the initialization of ExtractSelection, but I want to be able to update an existing filter (it’s possible in the GUI).

Any help would be appriciated.

Thank you.

---

<div class="post-metadata">

### Author: ![Hugo](https://discourse.paraview.org/user_avatar/discourse.paraview.org/hugo/32/7836_2.png) [@Hugo](https://discourse.paraview.org/u/Hugo)
#### Post date: [October 28, 2021, 3:35pm UTC](https://discourse.paraview.org/t/update-extractselection-filter-in-python/8279/2 "2021-10-28T15:35:47Z")

</div>

I’ve understood a bit better what’s happening :  
SelectGlobalIDs doesn’t return anything. I found this hidden function which actually returns something :

```auto
selection = _createSelection('GlobalIDSelectionSource', IDs=ids, FieldType="CELL",
                                         ContainingCells=False,)

```

Now :

```python
extract_sel.Selection = selection

```

is updating the GUI widget :  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/8/8ad02e88946679196d3397f3a7cbcb94815c2532.png)

But the filter remains empty :  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/7/73552cc82887becd332ca80a81b168bb225186f9.png)
