No module named system.opcua.callMethod

I am trying to connect to a opc device case code printer. I connected to it as an opcua device. In scripting, when trying to invoke methods (that i can see as tags when I browse the device), I get weird arrays of data that is illegible. I think I need to be using system.opcua.callMethod but i get the error that there is no module named opcua. system.opcua.callMethod - Ignition User Manual 8.0 - Ignition Documentation

Please help!!!!!!!!

Post your code.

Also, in your gateway->Config->Modules, do you see a OPC-UA module?

I do not have much code yet. We are trying to figure out how to communicate with this device and nothing is really working.
we have:

system.opc.readValue("ITWMCPrinter", "ns=0;i=50241")
system.opc.browseServer("ITWMCPrinter", "ns=2;s=GetStoredMessageList")
system.opc.getServerState("ITWMCPrinter")

and get the response:

[[Ljava.lang.Object;@207da8db, Good, Wed Oct 11 05:23:41 EDT 2023 (1697016221081)]
[BasicOPCBrowseElement[type=DATAVARIABLE, name=OutputArguments, desc=, datatype=class [Lcom.inductiveautomation.ignition.common.document.Document;, serverpath=[ITWMCPrinter]ns=0;i=50241]]
u'CONNECTED'

Yes OPC-UA module is licensed and active.

an example of the methods (as they show as tags in tag browser from the device below:

Someone else with more knowledge will have to chime in but system.opc is a different library from system.opcua. Maybe it's a different module you need. Not sure. But based on your error code that seems to be the issue, you're missing the necessary module.

Yes, agreed. I am confused because as posted earlier there is documentation for using system.opcua in v8.1 but it does not specify that it has to be imported or how to do so. I am pretty sure system.opcua.callMethod() is the ticket to make this work.

Just to make sure, you're trying to invoke this method from Gateway scope (or perspective session), right?

1 Like
  1. Please link current documentation. v8.0 is dead, dead, dead.

https://docs.inductiveautomation.com/display/DOC81/system.opcua.callMethod

  1. You cannot call this function from the designer script console. It is available in gateway scope only. (And Perspective, which is an extension of gateway scope.)

(Use a gateway message handler to call the function. In the designer, use system.util.sendRequest() to invoke it.)

1 Like

So script console is not gateway scope? I am doing this testing in Script Console and would later be setup as gateway scripts.

NO.

It is Designer Scope, which is an extension of Vision Client scope.

How can I test this and see the outputs or values returned from the specified methods if not in script console? It seems like its working but I cannot see the data being returned. I tried to create a string memory tag to write to but the "Length of values does not match length of paths."

Write your test code as a function in your project script library. Have it return the desired information. Call it from the gateway message handler, and have the handler end by returning what it got from your library function.

Then, in the script console, you will get that as the return from system.util.sendRequest().

1 Like

Thank you