Update ExtractSelection filter in python

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 :

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.

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

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

Now :

extract_sel.Selection = selection

is updating the GUI widget :
image

But the filter remains empty :
image