So I have some python code which goes like this
import mymodule
sum_global= mymodule.populateGlobalList("bigdict.txt")
and so on... with the code in mymodule including the method
def populateGlobalList(thefile):
#do the stuff
So far so ok.
But elsewhere in mymodule I have a method that says
def usefulFunction(arg1, arg2):
#lotsofstuff
if arg1 not in sum_global:
#add to list
So interpreter trips on undefined sum_global, which makes sense. Now usefulFunction could just take in sum_global as an argument, at least in theory. But sum_global is meant to be an English dictionary that is to be used extensively to check if words encountered are English words (or at least correctly spelled). As this occurs a lot, it would just feel unnecessarily awkward make it local.
On the other hand just declaring a global sum_global in the module (essentially to fool the interpreter), with the intention that this empty vessel is filled in in the program importing mymodule, feels completely wrong.
What is a sound design for this situation?