I was wondering whether its possible to get a variable (basically a list) from one python file into the main program file and then pass it into a class object in the main program file without first defining the variable (WORDS below) in the program file. I will explain the situation below. File words.py has a list named wordlist. I import this wordlist into the main program file main.py like:
# words.py file
wordlist = ['an',''..] # some list of words
# main.py
from words import wordlist
WORDS = wordlist.copy()
WORDS.remove('an')
mc = models_class(word_list = WORDS)
As i have tried the above works if i first define a local variable WORDS but can it work if i directly pass the wordlist into the class object and apply remove there, like below.
mc = models_class(word_list = wordlist.remove('an'))