Skip to content

MethodNode

Canonical path: o6.node.MethodNode

MethodNode

Bases: Node

A callable OPC UA Method node.

A server Method normally retains its construction Object. Methods without one, and Methods reached through an additional reference, use a lightweight bound value for that browse edge.

Functions

__call__

__call__(*args, object=None, attr=None, value=_UNSET)

Call this Method, or read and write one of its attributes.

Method-call syntax and attribute syntax do not mix: passing attr or value together with positional arguments raises.

Parameters:

Name Type Description Default
args Any

The Method's InputArguments, in declaration order. Node handles are cast to NodeIds automatically.

()
object Optional[NodeIdLike]

The Object to call the Method on. Needed only for a Method reached directly by NodeId, since dot lookup carries its Object.

None
attr Optional[AttributeId | str]

Read or write this attribute instead of calling the Method.

None
value Any

The value to write, for attribute syntax.

_UNSET

Returns:

Type Description
MaybeAwaitable[Any]

The Method's OutputArguments, or the attribute value.

Raises:

Type Description
Exception

Both syntaxes were mixed, or the Object for the call is unknown.

StatusCodeError

The Call service failed, or the Method returned a bad StatusCode.

__init__

__init__(backend, nodeId, browseName)

Wrap an existing node. Handles come from a client, server, or browsing.

Parameters:

Name Type Description Default
backend Any

The client or server backend that carries out operations.

required
nodeId NodeIdLike

NodeId of the node.

required
browseName QualifiedName

BrowseName of the node.

required

__getitem__

__getitem__(key)

Resolve a browse path relative to this node.

Use this where attribute access cannot reach: a BrowseName that is not a Python identifier, an ambiguous name, or a multi-step relative path.

Parameters:

Name Type Description Default
key str | 'ns0.datatypes.RelativePath'

A relative-path string such as "1:DeviceSet/1:Motor", or a ns0.datatypes.RelativePath.

required

Returns:

Type Description
MaybeAwaitable[list[Any]]

Every node the path resolves to, as a list; awaitable when the owning

MaybeAwaitable[list[Any]]

client or server runs on an external event loop.

Raises:

Type Description
KeyError

The path matches no node.