# Vision: Python get path to component as a string

**URL:** <https://forum.inductiveautomation.com/t/vision-python-get-path-to-component-as-a-string/26308>\
**Category:** Ignition\
**Created:** [July 5, 2019, 6:42am UTC](https://forum.inductiveautomation.com/t/vision-python-get-path-to-component-as-a-string/26308 "2019-07-05T06:42:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [July 5, 2019, 6:42am UTC](https://forum.inductiveautomation.com/t/vision-python-get-path-to-component-as-a-string/26308/1 "2019-07-05T06:42:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [July 5, 2019, 7:18am UTC](https://forum.inductiveautomation.com/t/vision-python-get-path-to-component-as-a-string/26308/2 "2019-07-05T07:18:18Z")

</div>

Use Window.getPathForComponent and Window.getComponentForPath

```python
w = system.gui.getParentWindow(event)
print w.getPathForComponent(event.source)

```
