# NameError: name 'event' is not defined

**URL:** <https://forum.inductiveautomation.com/t/nameerror-name-event-is-not-defined/26817>\
**Category:** Ignition\
**Created:** [July 23, 2019, 7:57pm UTC](https://forum.inductiveautomation.com/t/nameerror-name-event-is-not-defined/26817 "2019-07-23T19:57:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![danny.boyd](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@danny.boyd](https://forum.inductiveautomation.com/u/danny.boyd)\
**Post date:** [July 23, 2019, 7:57pm UTC](https://forum.inductiveautomation.com/t/nameerror-name-event-is-not-defined/26817/1 "2019-07-23T19:57:07Z")

</div>

In attempting to use a script for calling a popup menu found in knowledgebase article “Working with Power Table Extension Functions”, I get an error in the client console: "NameError: name ‘event’ is not defined ".  
The script is copied from the article. Any help would be appreciated.

:

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 23, 2019, 8:18pm UTC](https://forum.inductiveautomation.com/t/nameerror-name-event-is-not-defined/26817/2 "2019-07-23T20:18:22Z")

</div>

Where are you putting your code? The `event` variable will only exist in an event routine, or when deliberately passed from an event routine to another function.

---

<div class="post-metadata">

**Author:** ![danny.boyd](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@danny.boyd](https://forum.inductiveautomation.com/u/danny.boyd)\
**Post date:** [July 23, 2019, 9:10pm UTC](https://forum.inductiveautomation.com/t/nameerror-name-event-is-not-defined/26817/3 "2019-07-23T21:10:21Z")

</div>

I copied the code into the “onPopupTrigger” extension for the power table in question

---

<div class="post-metadata">

**Author:** ![grietveld](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/grietveld/32/6984_2.png) [@grietveld](https://forum.inductiveautomation.com/u/grietveld)\
**Post date:** [July 24, 2019, 11:45am UTC](https://forum.inductiveautomation.com/t/nameerror-name-event-is-not-defined/26817/4 "2019-07-24T11:45:38Z")

</div>

I found the [example code](https://support.inductiveautomation.com/index.php?/Knowledgebase/Article/View/109/2/working-with-power-table-extension-functions#onPopupTrigger) you are referencing. Do you know which line the error is occurring from?  
Can you post either a screenshot or the code as it is indented in your system so we can take a look?

---

<div class="post-metadata">

**Author:** ![danny.boyd](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@danny.boyd](https://forum.inductiveautomation.com/u/danny.boyd)\
**Post date:** [July 24, 2019, 12:30pm UTC](https://forum.inductiveautomation.com/t/nameerror-name-event-is-not-defined/26817/5 "2019-07-24T12:30:16Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/e2105b398a61074045319b1143cf09593e3cf0e7.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/03a0c2fd80f4443fa35afb511d450cbf9f081ab5.png)

---

<div class="post-metadata">

**Author:** ![danny.boyd](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@danny.boyd](https://forum.inductiveautomation.com/u/danny.boyd)\
**Post date:** [July 24, 2019, 12:32pm UTC](https://forum.inductiveautomation.com/t/nameerror-name-event-is-not-defined/26817/6 "2019-07-24T12:32:30Z")

</div>

First image of code as entered in the onPopup Trigger ext. Second image is from the console when I attempt to open the pop up. The error is on the last line of code; menu.show(event)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 24, 2019, 12:38pm UTC](https://forum.inductiveautomation.com/t/nameerror-name-event-is-not-defined/26817/7 "2019-07-24T12:38:22Z")

</div>

Indent your pasted code one level.

---

<div class="post-metadata">

**Author:** ![danny.boyd](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@danny.boyd](https://forum.inductiveautomation.com/u/danny.boyd)\
**Post date:** [July 24, 2019, 12:45pm UTC](https://forum.inductiveautomation.com/t/nameerror-name-event-is-not-defined/26817/8 "2019-07-24T12:45:59Z")

</div>

That did the trick. Thanks for the help!
