were all familiar with:

get_tree().get_root().get_node("rootNodeName")

but I completely forgot we have an autoload where we can all all sort of method or access variables, so all I did was add a return function call findNodeByName that takes 2 string the current scene and the node you want to find

func findNodeByName(currentScene, nodeName):
	return get_tree().get_root().get_node(currentScene +"/"+ nodeName)

keep in mind that the root node of the scene has to be the same or you could just use the rootNode instead(up to you really)

then just call it assuming the script is called Globals

var someNode = Globals.findNodeByName(get_tree().current_scene.name, "NameOfNode")

you could shorten it even further by getting the scene name and storing it in a variable in Globals

2 years later