Vision: Python get path to component as a string

Is there any way to get the relative path to a component as a string?
e.g. component relative to a button =
event.source.parent.getComponent('a').getComponent('b')

I would like to return this as a string, e.g.:
"event.source.parent.getComponent('a').getComponent('b')"

I want to pass this to a popup so that I can make changes to the component from a script in the popup… I won’t be using a path relative to a button, but rather a path relative to the window’s rootContainer

Use Window.getPathForComponent and Window.getComponentForPath

w = system.gui.getParentWindow(event)
print w.getPathForComponent(event.source)
2 Likes