Circular import problem

bvdp bob at mellowood.ca
Fri Jul 13 12:24:57 EDT 2007


> Seehttp://effbot.org/zone/import-confusion.htm
> Try to move the circular references later in the code (maybe inside a
> function, when it is required), or much better, refactor it so there is no
> circularity.
>
> --
> Gabriel Genellina

Yes, thanks. I'd read that page before posting. Helpful.

But, I still don't understand how python can access a function in a
file I have NOT included. In this case, to get things to work, I DO
NOT "import MMA.grooves" but later in the module I access a function
with "xx=MMA.grooves.somefunc()" and it finds the function, and works
just fine. It shouldn't work.

I have tried to delay the import, and that does work. But, from a
stylistic view I really to like to have all my imports at the top of
the module. Maybe some old assembler/C habits on my part.






More information about the Python-list mailing list