Saving doesn't completely finish before continuing execution

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

I’m trying to copy files and then load the copied file immediately after. I’m doing this because godot uses file extensions to tell which loader to use. Unfortunately there doesn’t seem to be a working way to force it to load files as ogg vorbis files. I tried using the type_hint, but that did nothing. I’m trying to load files that end with .egg as .ogg, so I tried copying them. But, godot won’t fully save the file even after flushing or closing. When I run the game again though after saving it loads the proper file.

This is what I have now

await DirAccess.copy_absolute(path + "/" + info["_songFilename"], "song.ogg")

var song = load("song.ogg")

Btw I tried both with and without await, has no effect.