Project-wide variable...

Gnarlodious gnarlodious at gmail.com
Thu Jun 23 23:49:29 EDT 2011


Let me restate my question.
Say I have a script Executable.py that calls all other scripts and
controls them:

#!/usr/local/bin/python
from Module import Data
import ModuleTest

ModuleTest.py has this:

print(Data.Plist.Structure)

Running Executable.py gives me this:
NameError: name 'Data' is not defined

1) Can I tell Executable.py to share Data with ModuleTest.py?
or if that can't be done:
2) Can I tell ModuleTest.py to "look upstream" for Data?

I have used two systems to accomplish this purpose:
1) Import Data into every module as it is loaded, which I am doing
now, and:
2) Load Data at the top and pass it downstream as a variable. This
gets a little cluttered and I quit doing it that way.

So I am looking for an easier way to load Data as an application-wide
variable. If its impossible to do what I want, I can accept that.

-- Gnarlie



More information about the Python-list mailing list