in gdscript, write:
var node = Node.new(); # You can use any node class here, not just the default
func _ready():
# Put some code here to modify the node variable (usually just change some
# properties, or connect some signals)
add_child(node)