I think that __main__ would be a very strange and unpredictable place to store shared data in your environment. If what you are after is a globals module to share settings, you could try something like this....
## testConstants.py ## BAR="foo" ## testScriptA.py ## import testConstants print "BAR=", testConstants.BAR testConstants.BAR = "blah" testConstants.FOO = "bar" ## testScriptB.py ## import testConstants print "BAR=",testConstants.BAR print "FOO=",testConstants.FOO # And when we try them out.... >>> import testScriptA BAR= foo >>> import testScriptB BAR= blah FOO= bar Because modules are only imported once, importing your constants module in multiple scripts will all reference the same module. You can then access all the objects within that module. On Tue, Jan 24, 2012 at 3:45 AM, [email protected] < [email protected]> wrote: > Hi, > > I have a question regarding the storage of data in Maya that should be > available in all my python scripts. > I found the "__main__" class and added an (immutable) variable to it > in the userSetup.py file. > > With this setup I can access the variable in all my scripts. > Do some of you guys have experience with this? Is it ok to store data > in __main__ or does it have implications > I don't know? > > Thank you very much, > > cheers, > > -- > Malte Dreschert > Senior Technical Artist @ Bigpoint > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
