Pass arguments when instantiating a scene via gdscript.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JulioYagami

How to pass arguments when instantiating a scene via gdscript? For example, I have a scene/node called “message”, it shows a message on the screen and I want to pass a string. I was thinking that it would be work like this:

func someFunction():
    var i = message.instance("random") # I think I have to put it here
    add_child(i)

func _ready(message):
    $label.text = message # I also have a child node called label (that extends Label)