Repository: godot
Issue: Changes to a tscn files nodetree are not updated.
Labels: bug,enhancement,discussion,topic:gdscript,topic:editor

### Tested versions

v4.2.1.stable.mono.official [b09f793f5]
v4.1.2.stable.mono.official [399c9dc39]



### System information

Godot v4.2.1.stable.mono - Linux Mint 21 (Vanessa) - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (nvidia; 535.129.03) - AMD Ryzen 5 1600 Six-Core Processor (12 Threads)

### Issue description

I've made this and other tool scripts that work similar:
```
	public void AddMesh3DToNode(Node parentNode, PackedScene pScene, String pScenPath)
	{
		MeshInstance3D meshInstance = new MeshInstance3D();
		GD.Print($"(AddMesh3DToNode) meshInstance: {meshInstance} parentNode: {parentNode} ");
		if (meshInstance is null || parentNode is null){GD.PrintErr("(AddMesh3DToNode) Failed to create mesh instance."); return;}

		Node ipScene = pScene.Instantiate();
		ipScene.FindChild(parentNode.Name).AddChild(meshInstance);
		meshInstance.Owner = ipScene;

		PackedScene pIpScene = new PackedScene();
		pIpScene.Pack(ipScene);
		ResourceSaver.Save(pIpScene, pScenPath);

		var editorInterface = GetEditorInterface();
		editorInterface.OpenSceneFromPath(pScenPath); 
		GD.Print($"(AddMesh3DToNode) Mesh3d Added to {ipScene}, {parentNode.Name} successfully");
		editorInterface.RestartEditor(true);
	}
```

The changes show inside the tscn file:
```
[gd_scene format=3 uid="uid://d341s877iwb4m"]

[node name="TestScene" type="Node3D"]

[node name="TestNode1" type="Node" parent="."]

[node name="@MeshInstance3D@18559" type="MeshInstance3D" parent="TestNode1"] //this is what is added via the above script

```
But this change does not show in the Scene dock until the editor is restarted. I've tried methods like reload_scene_from_path(), save_all_scenes() and others, it only shows if the editor is restarted manually or with restart_editor().
Any tool script that instantiates, changes, packs, saves a tscn file will cause this.

Without restart:
![Screenshot 2024-01-05 16:04:54](https://github.com/godotengine/godot/assets/40721994/967bda4b-fa98-4f0d-9eba-8ec202bd891e)

With restart:
![Screenshot 2024-01-05 16:05:32](https://github.com/godotengine/godot/assets/40721994/77c99018-1aa4-4872-a62a-3e6bfb3638af)

If this is not a bug I request an editor/Scene dock refresh method that can be called to show the changed tscn files.

Also if a scene is open in a tab the change is not saved at all. I've opened this for that issue:
https://github.com/godotengine/godot-proposals/issues/8806

### Steps to reproduce

Make tool script that makes and saves changes to an existing tscn file. (I've provided one above) 
Run the tool script and then check the scene dock. Then restart the editor and check the scene dock again. (make sure the scene is not open in a tab or the change will not be applied at all)

### Minimal reproduction project (MRP)

I've tried making one:
[addMeshMRP.zip](https://github.com/godotengine/godot/files/13844170/addMeshMRP.zip) (c#) I don't know GDscript so I can't make it in GDscript.

Could not test if it works as I get ```cannot run the script because it contains errors, check the output log.``` The output is empty.