PickObject and ISelectionFilter

I am working with python 3 in dynamo and i got stuck with ISelectionFilter. And i dont know why, even though a lot of code on the internet still working.

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = uiapp.ActiveUIDocument
class MySelectionFilter(ISelectionFilter):
    def __init__(self):
    def AllowElement(self, element):
        if element.Category.Name == "Walls":
            return True
            return False
    def AllowReference(self, element):
        return False

selection_filter = MySelectionFilter()
wall = uidoc.Selection.PickObject(ObjectType.Element,  selection_filter)
OUT = wall

The TypeError: interface takes exactly one argument
I think because the python 3 in dynamo revit 2024 does not support anymore.
Thank all.

Xinh Chao Anh Thanh!

  1. pyrevit does not support python 3 that well yet.
  2. the piece of code you provided misses the imports and seems to be a dynamo script. Not entirely the same framework, so it would need some tweaking depending on the import section
  3. plenty of example all around about ISelectionFilter:

The error you mention usually lists the line of the error, providing the full script + the full error text / providing context usually helps us provide with answer

Thank you alot . But I found a lot of example for that, but it sill didn’t work in dynamo. even thought i saw some doing that sucessfully on youtube.

You are in the wrong forum then. If you plan on getting things to work in dynamo, then the dynamo forum is the place to ask.