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
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 =
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
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