merging the global namespaces of two modules

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Thu May 22 08:46:42 EDT 2008


Fabrizio Pollastri a écrit :
> Hi,
> 
> just an import problem:
> a program imports two modules, modA and modB, each module do not known 
> anything about the other module (i.e. no cross imports in them), both 
> modules needs to refer to some functions that are defined in the global 
> namespace of the other module. 

IOW, you have a circular dependency between modA and modB.

> There is a possible solution? 

The obvious one : extract the relevant functions from modA and modB into 
modC and import modC in both modA and modB.

If not applyable in your case, please provide more informations.




More information about the Python-list mailing list