How do I access instanced scenes I've .set_name'd?

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

Trying to follow the docs’ multiplayer tutorial, and I know this is probably pretty basic stuff I’m missing, but I have a function which successfully spawns the players, that looks something like this:

for peer_id in player_info:
	var player = preload("res://OtherPlayer.tscn").instance()

And I have another function to control the movement of each player, that I want to work something like this:

func _on_multiplayer_movement(peer_id, position):
	peer_id.position = position

Where peer_id is the name previously assigned, but obviously this doesn’t work. I think the get_node line is almost certainly wrong, in some capacity, and I don’t really know where to begin in my second function, but any help would be appreciated.

:bust_in_silhouette: Reply From: sagev9000

I was just forgetting that I needed a get_node. So the second function should have

get_node(peer_id).position = position

And indeed, it works.