I have this code:
get_tree().change_scene_to_file("res://scenes/core/Lobby.tscn")
await get_tree().get_current_scene().name == "Lobby"
get_tree().get_current_scene().add_player_to_lobby(id)
My Lobby.tscn looks like this:

and the script attached to the Lobby (root) node is:
extends Node
func add_player_to_lobby(id):
print("Adding " + str(id) + " to the lobby")
The error says:
"Invalid call. Nonexistent function 'addplayerto_lobby’ in base ‘Control ()'.
And I'm not sure what is going on. It seems to me that I am in fact changing to the lobby scene otherwise the await would not pass, as the error is triggered by the "addplayerto_lobby" line of code. But somehow I'm not able to fetch the script, only the node? If it helps, the lobby script is a normal script and the one I mention above is a singleton (autoload and global variable)