Functions are not found

Hello everyone,

I have a function under Global Script that calls another function in the Project Script, I am intermittently receiving this error:

AttributeError: ‘com.inductiveautomation.ignition.common.script.Scr’ object has no attribute ‘util’

Obviously that function is existing so wondering why it keeps giving me this error.
Sometimes it will work If i restart the client application, but after sometime it will start giving me that error again.

Any suggestions how to get rid of this error?

Thank you.

Just wondering, why do you have a global script referencing a project script? If you make a new project, the global script will still be around, but it won’t have a reference to the project script.

I also suspect that it’s related to what’s going on: the global script getting loaded in a scope without access to the project scripts from time to time. Probably depends on some asynchronous processes, hence the randomness.

What are you trying to achieve exactly? Perhaps you can pass your project function as an argument to the global function if you want to differentiate it per project. Functions can be passed just like other arguments in python.

Concur. There should never be any project.* reference spelled out anywhere in shared.* scripts. Any project references within shared scripts must be passed in as function arguments or via object references.


Now it makes sense. I didn’t know you can’t call project scripts within shared scripts. or atleast it is not advisable to call it directly from shared.

I did passed the project script as an argument to the global function.

Thank you!