# Menu Tree - event.path validation

**URL:** <https://forum.inductiveautomation.com/t/menu-tree-event-path-validation/114599>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 20, 2026, 5:17pm UTC](https://forum.inductiveautomation.com/t/menu-tree-event-path-validation/114599 "2026-03-20T17:17:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruben.lopez](https://avatars.discourse-cdn.com/v4/letter/r/54ee81/32.png) [@ruben.lopez](https://forum.inductiveautomation.com/u/ruben.lopez)\
**Post date:** [March 20, 2026, 5:17pm UTC](https://forum.inductiveautomation.com/t/menu-tree-event-path-validation/114599/1 "2026-03-20T17:17:03Z")

</div>

Good morning,

I'm working on a project where I need to check which item in the MenuTree was clicked. Using `event.path`, I have the item's index, but when I try to use it in an `if` statement to trigger an action, nothing happens.

Here's the code:

```python
def runAction(self, event):
    clicked_item_path = event.path
    if clicked_item_path == [0,1]:
        self.getSibling("EmbeddedView").props.path = "View_Moldeo_L1"

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [March 20, 2026, 5:25pm UTC](https://forum.inductiveautomation.com/t/menu-tree-event-path-validation/114599/2 "2026-03-20T17:25:26Z")

</div>

Make sure you use the `onItemClicked` event. Then you can do something like this:

```python
def runAction(self, event):
	if event.enabled: # check if item is enabled
		self.getSibling("EmbeddedView").props.path = event.label
		
		# or if you need custom view paths #

		clicked_item = event.label.lower()
		if clicked_item == "some_string":
			view = "View_Moldeo_L1"
		elif clicked_item == "some_other_string":
			view = "View_Moldeo_L2"
		else:
			return
			
		self.getSibling("EmbeddedView").props.path = view

```

---

<div class="post-metadata">

**Author:** ![ruben.lopez](https://avatars.discourse-cdn.com/v4/letter/r/54ee81/32.png) [@ruben.lopez](https://forum.inductiveautomation.com/u/ruben.lopez)\
**Post date:** [March 20, 2026, 5:38pm UTC](https://forum.inductiveautomation.com/t/menu-tree-event-path-validation/114599/3 "2026-03-20T17:38:17Z")

</div>

The method you mentioned worked.

Thanks, Hayes.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [March 20, 2026, 5:40pm UTC](https://forum.inductiveautomation.com/t/menu-tree-event-path-validation/114599/4 "2026-03-20T17:40:02Z")

</div>

If you did need the full path for some reason, it seems the path value is a pyArray. You might need to cast it to a list for comparison.

```python
if list(event.path) == [0,1]:

```
