Re: sending a variable to an imported module

2011-12-08 Thread Bastien Semene
Thanks both, Putting the variable inside a module works well. As the content is an object created inside another module I'm using this trick : module.CONFIG = module.load() So the variable is handled by the module that creates/use it, easy to use and pretty "native" to understand. Le 08

Re: sending a variable to an imported module

2011-12-08 Thread Dave Angel
On 12/08/2011 06:28 AM, Bastien Semene wrote: Hi list, I'm trying to pass a variable to an imported module without singletons. I've seen in the doc, and tested that I can't use global to do it : === module.py === def testf(): print test === main.py === global test test = 1 imported_module =

Re: sending a variable to an imported module

2011-12-08 Thread Arnaud Delobelle
On 8 December 2011 11:28, Bastien Semene wrote: > Hi list, > > I'm trying to pass a variable to an imported module without singletons. > I've seen in the doc, and tested that I can't use global to do it : > > === module.py === > def testf(): >  print test > > > === main.py === > global test > test

sending a variable to an imported module

2011-12-08 Thread Bastien Semene
Hi list, I'm trying to pass a variable to an imported module without singletons. I've seen in the doc, and tested that I can't use global to do it : === module.py === def testf(): print test === main.py === global test test = 1 imported_module = __import__(module, globals(), locals(), [], -1