In the initial action on a SFC I have the following code in the 'onStart' function...
def onStart(chart, step):
chart.queue = recipe.obj.queue.Queue()
chart.loaded_program = None
sequence.control.set_current_sfc_step(0)
While the chart is running, I can see the 'queue' object
In another script, I am trying to fetch the queue object, to manipulate it, like so, obviously passing in 'queue' as the param_key
def chart_vars(param_key):
obj = None
if sequence.control.is_chart_running():
chart_id = utils.paths.get_tag(sequence.tag_paths.path_sfc_chart_id)
chart_vars = system.sfc.getVariables(chart_id)
obj = chart_vars[param_key]
return obj
However, running the above function from the scripting console causes a major exception, which seems to actually crash the connection to the gateway for 5 - 10 seconds. But interestingly does not crash the SFC instance.
Traceback (most recent call last):
File "<input>", line 2, in <module>
File "<module:sequence.get>", line 7, in chart_vars
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:351)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.getResponse(GatewayInterface.java:543)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:283)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:278)
at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.moduleInvokeSafe(GatewayInterface.java:917)
at com.inductiveautomation.ignition.client.gateway_interface.ModuleRPCFactory$DynamicRPCHandler.invoke(ModuleRPCFactory.java:53)
at com.sun.proxy.$Proxy47.getVariables(Unknown Source)
at com.inductiveautomation.sfc.client.scripting.ClientScriptingFunctions.getVariables(ClientScriptingFunctions.java:90)
at com.inductiveautomation.sfc.scripting.SfcScriptingFunctionsPyWrapper.getVariables(SfcScriptingFunctionsPyWrapper.java:117)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: ImportError: No module named queue
>>>
I get the feeling I am trying to do something that is bad practice and that's why this isn't working?
Is there a 'correct' way to do this, or is this a no no?
As always thank you!