Using variables across modules

Uwe Schmitt rocksportrocker at
Wed Jul 23 20:56:03 CEST 2008

Aaron Scott schrieb:
> I'm having some trouble understanding how Python handles variables
> across multiple modules. I've dug through the documentation, but I
> still find myself at a loss.
> When you import a module, are you creating an instance of the
> variables within? For instance, if I have one file, "",
> which contains "myvar = 0", and I import it into both "" and
> "" with the line "from variables import *", and then set myvar
> in "" and "" to different values, will each file have a
> different value for myvar? If so, how can I ensure that a change to
> myvar in "" is reflected by ""? Or am I completely off
> base?

Just wirte test code ! Python is cool for checking such things, you do
not have to compile, you need not write boilerplate main() stuff.

Greetings, Uwe

More information about the Python-list mailing list