# Event.source script error

**URL:** <https://forum.inductiveautomation.com/t/event-source-script-error/7205>\
**Category:** Ignition\
**Created:** [September 6, 2013, 1:24pm UTC](https://forum.inductiveautomation.com/t/event-source-script-error/7205 "2013-09-06T13:24:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbackus](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tbackus/32/5091_2.png) [@tbackus](https://forum.inductiveautomation.com/u/tbackus)\
**Post date:** [September 6, 2013, 1:24pm UTC](https://forum.inductiveautomation.com/t/event-source-script-error/7205/1 "2013-09-06T13:24:59Z")

</div>

Ok what’s wrong with this statement (using Interactive Sript Tester)

`scanRead = event.source.getComponent("LstRdBxTxt").text
print scanRead`

LstRdBxTxt is a text field on “Main Window” root container on this project.

I try to run it and immediately get an error “NameError: name ‘event’ is not defined”  
yet I see lots of examples showing this syntax, so I think I am missing an import or something.

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [September 6, 2013, 2:01pm UTC](https://forum.inductiveautomation.com/t/event-source-script-error/7205/2 "2013-09-06T14:01:03Z")

</div>

put that script on a action performed on a button component on the same window as your text component and it will work… I dont believe you can use it in the script tester like you are trying to do.

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [September 6, 2013, 4:30pm UTC](https://forum.inductiveautomation.com/t/event-source-script-error/7205/3 "2013-09-06T16:30:31Z")

</div>

Also, getComponent is a function of a container object so if you create the button as diat150 suggests, you’ll need to slightly change your code:

```auto
scanRead = event.source.parent.getComponent("LstRdBxTxt").text
print scanRead
```
