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(), [],
On 8 December 2011 11:28, Bastien Semene bsem...@cyanide-studio.com 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 ===
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
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