Circular import problem
greg
greg at cosc.canterbury.ac.nz
Sat Jul 14 21:26:51 EDT 2007
bvdp wrote:
> before I moved other
> imports around I was able to do the following:
>
> 1. NOT include MMA.gooves,
> 2. call the function MMA.grooves.somefunc()
>
> and have it work.
The import doesn't necessarily have to be in the same module
where the attribute is used. The first time *any* module
does 'import MMA.grooves', a grooves attribute gets put
into MMA, which can be used by any module that has a
reference to MMA.
It's probably not a good idea to rely on this, though,
and better to put an explicit 'import MMA.grooves' into
every module that uses it. Importing something more than
once does no harm.
--
Greg
More information about the Python-list
mailing list