Calling function of child node

I am having an issue similar to the one described on this reddit post: https://www.reddit.com/r/godot/comments/10za7cr/godot_4_calling_function_of_child_node/

However, the answers here only mention that I need to make sure the script is attached to my instanced node. What exactly does that mean? When I check if the node was instanced correctly (using is_instance_valid()), it returns true. How do I make sure the script is attached to each instance I create?

Thank you for the help!

It’s hard to understand your exact problem without seeing the code and node hierarchy. But it looks as if you do not have a script attached to the node that is being instanced or the function you are calling does not exist in the script that us attached (or you have a simple typo).

1 Like

screenshots of your node heirarchy would be helpful, and maybe the inspectors of node_A and node_B (to extend your links example), whatever you have those named. And the specific code involved. On windows: windows key + shift + s = screen capture a portion of the screen, its good for inspectors etc.

Without much more to go on one thing that comes to mind is a similar error I got when I would have a Tool script try to access a function of a non-Tool script from within the editor. Basically the non-Tool script does not properly exist, it will never be ready, and there will be errors like you described, in that situation. So on the off chance node_A is a Tool script, make sure node_B is too, if you’re trying to do MyFancyFunction() from within the editor.

Please disregard this question, I worked on it some more and figured out the error.