global variables in module

Harald Massa cpl.19.ghum at spamgourmet.com
Wed Feb 4 10:35:10 EST 2004


Zunbeltz,

> MyApp(wxApp):
> How can i use cf in other modules of the program. Did I need declare cf
> global, or make it a module variable, ... Any hint, please

is used the following approach:

1) defining one module named

ReportGlobals

loggedInUser="nasenbaer"
workerQueue=Queue.Queue()

there all varibles which are "konfiguration related" are defined, also 
"programm global queues", "error loggers", "database connection pool"

All these variables are defined as module level variables
(on "indent 0" :))) )

2) in all modules of the programm I use

import ReportGlobals as gl

print "You are %s" % (gl.loggedInUser,)


HTH

Harald



and access the



More information about the Python-list mailing list