I’m trying to call a global shared function containing calls to the api from the script console.
I’ve included a screenshot to provide the context.
The function starts with:
‘from com.inductiveautomation.ignition.gateway import SRContext’
When calling the function in the script module, I get an error message that says ‘No module named gateway’
By the way, I get the same error if I try the put the function code directly in the script module.
In contrast, I created a tag which calls this function and the function calls executes properly there.
You could also use sendRequest with a Gateway message handler that calls the shared scripts. Since you’re using a parameter, you could pass a payload within sendRequest to specify the datasink name.
In Gateway message handler: shared.StoreAndForward.cachePending(payload["name"])
In script console: system.util.sendRequest("projectName", "messageHandlerName", {"name":"myDataSinkName"})