Expression 'runScript' fails to run script from module

Using 7.6.3 in Windows Server.

If I do runScript(int('20'), 10000) that runs fine.

However, if I define a function in the script module as ‘app.test.run()’

def run(strint): return int(strint)

And call thusly in an Expression tag:

runScript("app.test.run('20')", 10000)

Nothing. Just the dread red x and null. And nothing shows up in the console. Same deal with non-trivial functions that work in the playground.

Am I doing something wrong?

And I figured out the reason it won’t run is that it’s in a non-Client Expression tag.

Is there not a way to run multi-line python code in a non-Client tag?

You are right, the app.* functions are in the project and SQLTags are not (except for Client Tags) so there is no way to call app.* from an Expression Tag. There is a sneaky way to get around the one line of code limitation, but it will be difficult to troubleshoot errors. You can use the newline character (\n) in a script to create multiple lines of code.runScript("myvar=5\nreturn myvar")

So I guess my feature request would be a callable gateway script module :stuck_out_tongue:

Glad I found a workaround to my issue, because I’m not going anywhere near that newline hack.

Global Script Modules are planned for Ignition 7.7: viewtopic.php?f=70&t=11069

These should be callable from runScript.