I've tested this on 3.5 and 4 and it seems that a script set as tool cannot access child functions of an instantiated scene. There must be something I don't understand.
I have a child scene (TextureRect) called InstantChild with this function:
extends TextureRect
func print_hello():
print("Hello from the child")
I instantiate that in another scene (Node2D) called InstantParent.
InstantParent is then instantiated in my tool scene called TestTool and I give it this script code:
tool
extends Node2D
onready var child:TextureRect = $InstantParent/InstantChild
export var text:String setget set_text, get_text
func set_text(value:String):
if Engine.editor_hint:
child.print_hello()
#$InstantParent/InstantChild.print_hello() # this line gives the same error
func get_text():
return text
```
When adding text to the exported variable I get the message:
> <built-in>:9 - Invalid call. Nonexistent function 'print_hello' in base 'TextureRect (InstantChild.gd)'
Am I doing something wrong or is this not permitted or is this a bug?