Event.source script error

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.

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.

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:

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