Skip to content
Discussion options

You must be logged in to vote

You can use a class for example:

class MultiplyMethodCallHandler:
    def __init__(self, target) -> None:
        self._target = target

    @uamethod
    async def call(self, parent, y, x):
        print(self._target)
        await self._target.write_value(ua.Double(x * y))
        print(x * y)
        return x * y

.....

async def main():
    .....    
    mydouble = await myobj.add_variable(idx, "MyDouble", 0.0)
    callh = MultiplyMethodCallHandler(mydouble)
    multiply_node = await myobj.add_method(
        idx,
        "multiply",
        callh.call,
        [ua.VariantType.Double, ua.VariantType.Double],
        [ua.VariantType.Double],
    )

The other possiblity is to use inner …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@IevgenVovk
Comment options

Answer selected by IevgenVovk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants