Iterate through all components programatically in perspective?

I was wondering if there’s a way to iterate through all components on screen for a perspective view? I was trying to use getRootContainer and getChildren but it doesn’t seem as straight forward as I thought/as it was for Vision. Any know how this is done?

You’ll have to recurse down the children; eg:

def recurse(component):
		return { recurse(child) for child in component.children}
1 Like

And that component in recurse(component) would or at least could be a container right? Love recursive solutions, they’re so recursive.

1 Like

Right, just start the function with whatever component you want to build your tree from.