Question about import and namespace

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri Sep 1 07:43:52 EDT 2006


In <1157109701.182636.23260 at m79g2000cwm.googlegroups.com>, jdemoor wrote:

> I have an application started by a main.py file, which does a ' from
> module_1 import * '.
> main.py is responsible from the creation of an object which is then
> used in module_1.
> What is the best way to make that object visible in the module_1
> namespace ?
> I guess that if I do an ' import module_1 ', I can make the object
> visible with ' module_1.myObject = myObject ', but that won't work with
> the from ... import * statement.

Give the object as argument to functions in `module_1` is a clean solution.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list