I'm trying to invoke a function from one node into another

Node1_script:

extends Position2D func sample(): print('well you invoked me, now what?') 

Node2_script:

tool ... func some_function(): print($"Node1".sample()); 

but it gives the error:

Invalid call. Nonexistent function 'sample'

3

1 Answer

Ah I got the problem, it was in tool mode

for future reference, if you want to invoke a function in tool mode you have to make sure the function definition is also in tool mode:

Node1_script:

extends Position2D tool func sample(): print('well you invoked me, now what?') 

Node2_script:

tool ... func some_function(): print($"Node1".sample()); 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.