Saving image does not appear in File System Dock

Godot Version

4.2.1

Question

in my Editor Plugin script, this line of code creates a new image resource:
image.save_png("res://Images/imageName.png")

but it does not appear in the FileSystem dock.
I must minimize Godot and then maximize and I see a popup with “reimporting assets” and THEN I can see the newly created file.

how can I avoid this and simply refresh the fileSystem dock myself? or is there another way to create a texture asset that will save properly in the Godot app?

You need to call EditorFilesystem.scan() after adding or removing files to signal the editor that the filesystem changed. Something like: EditorInterface.get_resource_filesystem().scan() should work.

1 Like

thanks, this works. its a bit slow and shows the “loading popup” but it refreshed the fileSystem dock.
i tried resource.load and many other things but there is just no way to create a resource and have it instantly appear in the file system dock, so i guess scan is only way