UPDATE: I ended up importing the library at the top of the Project Library my component calls scripts from. In this case, my component is a Button and it's event calls functions in the Button script. So I have the import statement at the top of the Button script.
ORIGINAL POST
I'm running Ignition 8.1 with a Trial License and I have a general question regarding importing libraries. In general, say I want to use a library in a script called by a component event. There are several instances of this component so I don't want to include the "from xxx import xxx" statement on every event. So where do I make the "from xxx import xxx" call?
(Me not programmer, me make sparky sparks)
I tried defining a Project Library script that is meant to import all libraries I need on startup. I think I need to call this script from the Session Events > Startup event. The following are snippets of the Project Library script, Session Event Startup function call, and usage of the library on the component onClick event (top to bottom):
My test method:
- Restart session on browser
- Go to view with component that uses this library in script tied to its onClick event
- Go to preview mode
- Click on component
- Get undefined Timer error
- Pull out hair
If I click on a component in the active Perspective Session I also get the error in the Gateway logs.