I have a python module that makes use of a huge dictionary global variable, currently I put the computation code in the top section, every first time import or reload of the mod
If the 'shelve' solution turns out to be too slow or fiddly, there are other possibilities: