[Tutor] i need to see a var from any where in my app - im clueless
Kent Johnson
kent37 at tds.net
Thu Apr 14 14:18:25 CEST 2005
pxlpluker wrote:
> i want to read a global (OPTIONS) from file1 from a class method
> (func1) in file2
> but i cant see the OPTION from func1
>
>
> ----------------------------------------------
> #file1.py
> import file2
> import sys
>
> OPTION = sys.argv[1:]
> pass
> a=global2.class1()
Presumably you mean file2.class1() here; global2 is not defined
> a.func1()
One good option is just to pass OPTION as a parameter here:
a.func1(OPTION)
>
> #file2.py
> import __main__
Alternately you can
import file1
then in func1() you can refer to file1.OPTION
Kent
> pass
> class class1:
> . def func1(self):
> . pass
> -------------------------------------------
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list