# No module named system.opcua.callMethod

**URL:** <https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [October 11, 2023, 1:17pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336 "2023-10-11T13:17:55Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![MC2338](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@MC2338](https://forum.inductiveautomation.com/u/MC2338)\
**Post date:** [October 11, 2023, 1:17pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/1 "2023-10-11T13:17:55Z")

</div>

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](https://docs.inductiveautomation.com/display/DOC80/system.opcua.callMethod)

Please help!!!!!!!!

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [October 11, 2023, 1:21pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/2 "2023-10-11T13:21:47Z")

</div>

Post your code.

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

---

<div class="post-metadata">

**Author:** ![MC2338](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@MC2338](https://forum.inductiveautomation.com/u/MC2338)\
**Post date:** [October 11, 2023, 1:26pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/3 "2023-10-11T13:26:15Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/5/15573afc730af5170ce6b2fee2e8fc91ebbc5bfe.png)

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [October 11, 2023, 1:30pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/4 "2023-10-11T13:30:22Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MC2338](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@MC2338](https://forum.inductiveautomation.com/u/MC2338)\
**Post date:** [October 11, 2023, 1:32pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/5 "2023-10-11T13:32:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kcollins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kcollins/32/19646_2.png) [@kcollins](https://forum.inductiveautomation.com/u/kcollins)\
**Post date:** [October 11, 2023, 1:32pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/6 "2023-10-11T13:32:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 11, 2023, 1:32pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/7 "2023-10-11T13:32:55Z")

</div>

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

[https://docs.inductiveautomation.com/display/DOC81/system.opcua.callMethod](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.)

---

<div class="post-metadata">

**Author:** ![MC2338](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@MC2338](https://forum.inductiveautomation.com/u/MC2338)\
**Post date:** [October 11, 2023, 1:34pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/8 "2023-10-11T13:34:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 11, 2023, 1:35pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/9 "2023-10-11T13:35:18Z")

</div>

> [@MC2338](#):
>
> So script console is not gateway scope?

NO.

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

---

<div class="post-metadata">

**Author:** ![MC2338](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@MC2338](https://forum.inductiveautomation.com/u/MC2338)\
**Post date:** [October 11, 2023, 2:04pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/10 "2023-10-11T14:04:44Z")

</div>

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."

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 11, 2023, 2:16pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/11 "2023-10-11T14:16:07Z")

</div>

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()`.

---

<div class="post-metadata">

**Author:** ![MC2338](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@MC2338](https://forum.inductiveautomation.com/u/MC2338)\
**Post date:** [October 11, 2023, 5:31pm UTC](https://forum.inductiveautomation.com/t/no-module-named-system-opcua-callmethod/80336/12 "2023-10-11T17:31:15Z")

</div>

Thank you
