I have a sequence of two message handlers (one on the gateway events for the project) and one on a component in perspective. I've confirmed that the gateway message handler is triggered and runs succefully, but I get an error when it tries to execute the perspective-scoped message. This was working just yesterday, and with no apparent changes it has started throwing this error. Here is the Gateway Event Message Script:
#This message handler is triggered by the Forms.Forms.submitForm method in project "Forms".
system.util.getLogger("Ignition Forms").debug("forms-submitted message handler recieved in project")
messageHandler = "form-submitted-view"
system.perspective.sendMessage(messageType=messageHandler, scope="session")
and here is the error from the gateway logs:
com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 7, in handleMessage at com.inductiveautomation.perspective.gateway.script.AbstractScriptingFunctions.getSession(AbstractScriptingFunctions.java:104) at com.inductiveautomation.perspective.gateway.script.AbstractScriptingFunctions.operateOnSession(AbstractScriptingFunctions.java:118) at com.inductiveautomation.perspective.gateway.script.PerspectiveScriptingFunctions.sendMessage(PerspectiveScriptingFunctions.java:745) at jdk.internal.reflect.GeneratedMethodAccessor893.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.base/java.lang.reflect.Method.invoke(Unknown Source) java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: No perspective session attached to this thread.
I'm unable to figure out how to account for the "No perspective session attached to this thread" error, and find it bizarre that this same script triggered the appropriate message handler on the component when I was testing it out yesterday.