What is the consensus on the best way reference module level variables? I have a wx app that has grown too large, so I started to do some housekeeping. I'm trying to move several functions outside of the main module while still being able to reference the main variables.. The program works if I include
from __main__ import *
at the top of the child modules, however it only works once. If I run the script without completely closing all python windows it raises
Traceback (most recent call last): File "C:\Python25\Lib\roster\roster_main.pyw", line 427, in Login Conform.Run() File "C:\Python25\Lib\roster\Conform.py", line 197, in Run window.UpdateSearch() File "C:\Python25\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 14528, in __getattr__ raise PyDeadObjectError(self.attrStr % self._name) wx._core.PyDeadObjectError: The C++ part of the MainFrame object has been deleted, attribute access no longer allowed.
Is there a better way to do this?