Reading Variables From Modules ?

Peter Moscatt pmoscatt at bigpond.net.au
Tue Sep 11 04:32:14 EDT 2001


I have a simple question - well to some I hope :-)

If I was to have a module named MyModule.py which had a function like:

        def TestNumber():
                A = 10
                return

And I was importing this module into MyMain.py and then wanted to test the 
value of A in the imported module like:

        import MyModule
        if MyModule.A > 10 dosomething

Obviously this dosen't work, so how is the best way to test the value of 
'A' in the imported module ?

Regards
Pete



More information about the Python-list mailing list