Global var access in imported modules?
slfds at spam.not
Thu Aug 28 03:47:54 CEST 2008
Fredrik Lundh wrote:
>> import utility.py
> that tries to import a module named "py" from the package "utility".
oops - that was just a typo in my post - I meant of course "import utility"
> Python doesn't have "program-wide global" variables; if you need that,
> create a support module and import that module everywhere you need to
> access those variables:
> # file: globalvars.py
> sName = ""
> # file: myprogram.py
> import globalvars
> print globalvars.sName
That's news - thanks, I didn't realize that there just wasn't the
concept of program-wide globals. The support module idea sounds like a
More information about the Python-list