Your name error does not occur in the method. It occurs before the method is called.
Python tries to resolve node2
before it can pass the value of node2
to the message.arrive()
method. The method code is never executed.
You'd get the same error if you just typed node2
in your shell, you did not define it so Python doesn't know how to use it's value then either.