Im really new to Godot and have a fairly simple question that I just cant seem to wrap my head around: How to i call a function of a Script attached to an Instance?
For example:
In the Main Script of a test Project of mine there are the following lines of code:
var scene = preload("res://Ball.tscn")
func _ready():
var test = scene.instance()
test.test()
The Script attached to Ball contains the following:
func _test():
print("Success")
The error i get if i try to run this code is "Invalid call. Nonexistent function 'test' in base 'RigidBody2D (Ball.gd)'
Obviously there is no function called test in RigidBody2D which seems to be the error here, but then how do i refer to the Script of an Instance?
Thanks in advance for any help provided.