global variables or inheritence

Jeff Massung jmassung at magpiesystems.com
Wed Apr 26 16:02:15 EDT 2000


Sorry if I get this wrong... but I thought you'd just import your other
file.

Example:

# File1.py
myVar = 2


# File2.py
import File1
print File1.myVar #should print 2

Jeff

Thomas Rasmussen wrote in message <28p8zy0irgc.fsf at lada.kom.auc.dk>...
>Hi
>
>I have quite a big problem. I have two different files, where I in one
>file want to declare a variable and then in the other file be able to
>access and use this variable (no need to change it), but I just can't
>seem to get it to work... Is there any nice way of doing this easily?
>I have tried the global var but this doesn't seem to work.
>
>Anyone got a good idea?
>
>Thomas
>--
>KOM Network student helper
>
>"To alcohol! The cause of - and solution to - all of life's problems!"
>-- Homer Simpson





More information about the Python-list mailing list