global instance question (newbie)

Chris Liechti cliechti at gmx.net
Sat Apr 6 16:31:06 EST 2002


"manouche" <emmanuel at onda-latina.com> wrote in
news:a8njqq$phs$1 at wanadoo.fr: 

> hello,
> 
> How can I create a global object that I can be used in all the files
> of my project?
> Using "global" I can only access to the instance in the file where it
> was created.

put it in a separate module and import it where you need it.
of course you can add and modify the values on that module.

there is only one module instance in the interpreter, no matter how much 
you import it (singelton is the keyword).

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list