I am tyring to add a node to a scene through the editor. I am able to open scene but specefied node does not get added in code.

# Open scene | Get scene root
editor_interface.open_scene_from_path("res://addons/graphs/graphs_core_editor/scenes/scene_graphs_core_editor_scene_3D.tscn");
var scene_root = editor_interface.get_edited_scene_root();
			
# Create graph runner | Add it to the scene
var graph_runner = GraphsCoreRuntimeGraphRunner.new();
scene_root.add_child(graph_runner);

I also tried
scene_root.get_tree().get_root().add_child(graph_runner);

  • It sounds like you're making an editor plugin/tool script?

    From the docs:

    Note: If you want a child to be persisted to a PackedScene, you must set owner in addition to calling add_child. This is typically relevant for tool scripts and editor plugins. If a new node is added to the tree without setting its owner as an ancestor in that tree, it will be visible in the 2D/3D view, but not in the scene tree (and not persisted when packing or saving).

    Try:

    var graph_runner = GraphsCoreRuntimeGraphRunner.new()
    scene_root.add_child(graph_runner)
    graph_runner.owner = scene_root

It sounds like you're making an editor plugin/tool script?

From the docs:

Note: If you want a child to be persisted to a PackedScene, you must set owner in addition to calling add_child. This is typically relevant for tool scripts and editor plugins. If a new node is added to the tree without setting its owner as an ancestor in that tree, it will be visible in the 2D/3D view, but not in the scene tree (and not persisted when packing or saving).

Try:

var graph_runner = GraphsCoreRuntimeGraphRunner.new()
scene_root.add_child(graph_runner)
graph_runner.owner = scene_root