I’ve created two modules that expose functionality that I’m leveraging within scripts. I’d like to find a way to leverage this exposed functionality within a transaction. I’m trying to create a transaction such that …
[ul]
- A tag triggers the transaction to execute
- A method my module exposes through script will be called, providing a value.
- The value generated by the method call will be pushed into another tag.
[/ul]
Just as an initial test, I’ve tried the following …
[ul]
- Create a script module that def’s a method, performs an import, then returns the results of a call to my method
def getUuid():
import blah.bleh.bluh
return blah.bleh.bluh.getUuid()
2. Created a transaction and create an Expression Item. Within the Expression/SQL tab, I added a call to runScript() that calls the script module’s method.runScript("app.module.getUuid()")
[/ul]
When I attempt this, the item has an error when evaluating …
[code]com.inductiveautomation.ignition.common.expressions.ExpressionException: Error executing script for runScript() expression:app.module.getUuid()
Caused by: Traceback (most recent call last):
File “expression:runScript”, line 1, in
File “module:module”, line 2, in getUuid
ImportError: No module named blah
Caused by: Traceback (most recent call last):
File “expression:runScript”, line 1, in
File “module:module”, line 2, in getUuid
ImportError: No module named blah[/code]
If it helps, I’m using the addScriptModule() of the ScriptManager to expose things via script, (using RPC).
Thanks!