Why does it say " The identifier "WordList" isn't declared in the current scope?

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

Hello,I am new to Godot and I am following the Typing Game Tutorial on Youtube (part 3) and following his steps however, when I get to adding my list of words into a function in the enemy, it says that it is not declared in the current scope.

onready var words = $RichTextLabel
onready var words_text = words.text 

func _ready() -> void:
        words_text = WordList.get_words()

I have a unlinked script named “WordList” which I am trying to get the words from. I have tried to set WordList as a variable with the script path, but then I get the error Invalid call. Non-existent function “get_words()” in base ‘string’

:bust_in_silhouette: Reply From: alexp

It’ll be helpful to include the full text of this script and your WordList script, so we can see if you’re using class_name or if there are errors preventing the WordList from compiling. Based on the invalid call message, it sounds like you were assigning the path string to WordList, when you want
var WordList = load("res://path/to/WordList.gd")