Inside board.py
, don't just open the bare filename "words.txt".
Instead, use the __file__
variable to get the full pathname of the current python file, and use that to construct the full path to the words.txt file.
this_directory = os.path.dirname(__file__)
words_file = os.path.join(this_directory, "words.txt")
with open(words_file) as file:
...
Was this approach not obvious from the duplicate answer?