The imp module and cyclic imports

Matthias Kramm m.kramm at
Sun Nov 27 14:03:30 CET 2005

> the problem you're seeing appears also if you use "import"
> or "from web import one" or "__import__('')".

Thanks for the hint. You're right. This isn't actually imp related. The
standard import also fails.

> if you replace the "from web import" statements with plain imports,
> everything will work as expected.  just change
>    from web import one
> to
>   import one

Unfortunately, this fails if and are in different
With a setup like
there doesn't seem to be any way to make and reference
each other via (non-delayed) imports.

It's interesting, though, that cyclic imports work when using the plain
"import foo" import, but not with the "from package import foo" style.
Especially since the former also used to fail (google for "python
cyclic imports" on I wonder whether the "from"
style imports were overlooked when the cyclic problem was fixed.



More information about the Python-list mailing list