I am unable to access my scripts in my project that is defined as my “Gateway Scripting Project” from other projects. I am running Ignition 8.1.1.
In my Gateway Settings I have the project defined:
I have some scripts defined:
I then try to call those scripts from another project’s button click event:
I have tried the code in various ways to get it to work, none of them seem to result in a successful function call:
code:
print(shared.chris_test_module.test2.addtest(1))
error:
NameError: name 'shared' is not defined
code:
print(chris_test_module.test2.addtest(1))
error:
NameError: name 'chris_test_module' is not defined
code:
import chris_test_module
print(chris_test_module.test2.addtest(1))
error:
ImportError: No module named chris_test_module
code:
print(IGN01_GatewayTasks.chris_test_module.test2.addtest(1))
error:
NameError: name 'IGN01_GatewayTasks' is not defined
code:
from chris_test_module import *
print(chris_test_module.test2.addtest(1))
error:
ImportError: No module named chris_test_module
I’ve tried quite a few different variations of the above with no success. I’ve also tried changing the advanced settings on the button from “legacy scoping” to “standard scoping” and back again with the various ways I’ve written the code and it has not worked.
The original purpose of this was to create a gateway level function I could call in a runscript() expression on a tag since those must be globally scoped to run on a tag and not project scoped but I started noticing it was not working, so I moved it to a Vision window while testing to simplify the issue and take runscript() out of the equation.
I’ve tried restarting the gateway and that did not fix it either. Is there some syntax I am missing when calling a Gateway Scripting Project library? Some other setting I do not have configured correctly?