godot spawn object code example
Example: godot spawn object
node = preload("res://node.tscn") #Whatever you want to spawn
func whatever():
nodeInstance = node.instance()
nodeInstance.position = Vector2(x, y)
add_child(nodeInstance) #Spawns wherever script is attatched.