runScript and Expression Tags

Is it now possible to use runScript to run script in the global script library shared? I would thought it would be but I seem to be having problems getting it to evaluate.

Kurt

Yes, it is now possible. What problem(s) are you having? Any error message?

This article may help for debugging: perfectabstractions.com/blog … nt-scripts

Best,

Pretty simple: runScript('shared.OEE.getFaultBit()')

Runs fine in the script playground. The script in question returns an integer. All I get for tag diagnostics is

I see. The error message does not provide enough information to determine what the problem is.

Use the “Try/Except with Logging” method of debugging in the
Debugging and Testing Gateway Scripts in Ignition article to get more information about the problem.

Once the error is logged you can see it in the Console Gateway Configuration webpage.

That shed some light on things. The script was using system.tag.read. When calling it from the script playground it was fine but when called from an expression tag you I needed to specify the tag provider, in this case [default] in the tag path.

Kurt

1 Like

Yes. Great!

I am struggling a bit with runScript in expression tags. My first issue was that I did not immediately realize that these need to call shared scripts vs project(the documentation still says app.), but this makes some sense to me since it is dealing with the tag database.
The second issue seems to be that I get an evaluation error if I try to import certain modules (I also moved them to the shared.
space). It seems to be my modules that in turn import additional modules - if I import a module without it’s own imports, It does not seem to be a problem. If there are imports in the imported script, I get an ‘error executing script’ error in tag diagnostics.
Everything works fine in the script playground.
Do I have to write “flat” modules for use with runScript ?

Hi papermaker,

You just can’t import modules that don’t exist to expression tags. For example you can’t import modules from a “project” package because how would a tag know which project to import a Python module from?

You can import any Python modules you want as long as they exist to tags.