Problem with modules refering to each other

Phil Hunt philh at vision25.demon.co.uk
Sun Aug 8 13:26:09 CEST 1999


In article <slrn7qq4as.cc2.kas at titan.magnetic-ink.dk>
           kas at maps.magnetic-ink.dk "Klaus Alexander Seistrup" writes:
> Phil Hunt wrote:
> >    #bak.py
> >    from hhh import *
> >
> > [...]
> > 
> >    #hhh.py
> >    from bak import *
> 
> Do we have a circular reference here?

Yes. Does Python not allow this? What's the workaround? (Originally 
my two modules were one, with hhh containing subclasses of bak's
classes, and bak containing code to dynamically create instances
of hhh classes at run time, using:

   newInstance = eval(nameOfClass + '()')

but I wanted the code split up into two modules as it is logically 
separate.)

-- 
Phil Hunt....philh at vision25.demon.co.uk





More information about the Python-list mailing list