Skip to content

[Question] uamethod no parent #1496

Answered by schroeder-
AiyionPrime asked this question in Q&A
Discussion options

You must be logged in to vote

Just make a wrapper function

 def remove_parent(func):
     def wrap(parent, *args):
          return func(*args)
     return wrap

class PinController:

    def __init__(self, some_server: Server):
        self.server = some_server
        server.link_method(
            server.get_node(ua.NodeId.from_string("ns=1;i=42")), uamethod(remove_parent(self.on_set_output))
        )

    def on_set_output(self, pin: ua.UInt32, value: ua.Boolean) -> None:
        # set the pin to something useful
        pass

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

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

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

This discussion was converted from issue #1493 on November 17, 2023 08:33.