Moving script from project library to shared library is giving me an error

I recently moved a script that I was working on from the project script library to the shared script library, and I am now getting the following error when I try to call the function from the script console:

AttributeError: 'com.inductiveautomation.ignition.designer.gui.tool' object has no attribute 'SCRIPT NAME'

I know that by moving it from the project library to the shared library I am changing the scope from project to gateway, but the only system functions I am using in my script are system.tag.readAll and system.tag.writeAll. I am also importing python's threading module. I am wondering if maybe you cannot import python modules in gateway scoped scripts? Has anyone encountered anything like this before?

No, neither project.* nor shared.* scripts have a scope of their own. They run in whatever scope calls them. The shared.* scripts just happen to be the only ones available to gateway global scope.

Look for a syntax error or some other problem. Closely examine your logs, and make sure you've saved your project(s).

I copy pasted it exactly from the project library so I have the exact same script in both the project library and the shared library. When I call the one in the project library, it works perfectly, but the one in the shared library throws an error.

Show your calling code. Describe where it is. Show the complete error. Show any errors you have in your log/console.

Sure, I am calling both from the designer's script console.
Here is how I am calling the script from the shared library:

plant_id = '257'
process_id = '322'
shared.SYS_20_advanced_controls.mod_50.multiplex_mpc_params(plant_id, process_id)

Here is how I am calling the script from the project library:

plant_id = '257'
process_id = '322'
project.MPC_Params.multiplex_mpc_params(plant_id, process_id)

For both of those, I right clicked on the function and pressed "Copy Full Path" to ensure that I am getting the correct path to the function.
Here is the full error from the script console:

Traceback (most recent call last):
  File "<buffer>", line 3, in <module>
AttributeError: 'com.inductiveautomation.ignition.designer.gui.tool' object has no attribute 'multiplex_mpc_params'

Hmm. Restarted your designer?

1 Like

I just tried that - no luck. BTW, thanks for the help, much appreciated. It seems to think that my 'mod_50' script is a 'com.inductiveautomation.ignition.designer.gui.tool' object... That doesn't seem right. Just to be clear, SYS_20_advanced_controls is a package, then mod_50 is a script in that package, and multiplex_mpc_params is a function in that script.

What 7.9 version? This feels a bit familiar, but it's also been a long time since any 7.9 version was released.

The slightly weird type is because the script console wraps things up for internal reasons.

We're on 7.9.18.

Does it work from a vision button, out of curiosity?

It just tested it and it did not work. It gave me a similar error:

Traceback (most recent call last):

  File "<event:actionPerformed>", line 1, in <module>

AttributeError: 'com.inductiveautomation.ignition.common.script.Scr' object has no attribute 'multiplex_mpc_params'

I've seen this when a code error or indentation error prevents the library from compiling properly.
Look for any red lines in the script editor.

1 Like

I copy-pasted it from the project library where it was working fine, and I just double-checked it and do not see any of those types of errors.

I know you said you saved the project, but have you published the changes since this is 7.9?


Yes I saved and published. I've got an update however: I tried the exact same thing on a different gateway (different site) running the same version of ignition and it worked. Seems like there is something buggy about the specific gateway that I was using at the time. All other gateways I have tried so far have worked.