Access to variables of instanced scenes from main script ||invalid get instance (on base: 'null instance')

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

So, I am making a basic typing game.
My current main script creates an instance of a letters scene for use in the main scene.
I need to keep track of the random letter or word generated for removal on user inputs.

My primary question is how you go about accessing members of an instanced class.
Currently:

func _on_WordsTimer_timeout():
$WordsPath/WordSpawnLocation.set_offset(randi())
words = Words.instance()
add_child(words)
print($words.letter)
words.position = $WordsPath/WordSpawnLocation.position

The print statement is my primary point of questioning here.
On running my project with no print statement characters spawn as expected.
With the print statement however I am getting
Invalid get index 'letter' (on base: 'null instance')

How should I go about accessing member variables of an instanced child node for usage in the main or other scripts?

:bust_in_silhouette: Reply From: kidscancode

words is the variable you assigned the instance to, so you wouldn’t put a $ in front of it.

print(words.letter)