NameError in cross imports of modules

Fredrik Lundh fredrik at effbot.org
Sat Feb 3 21:14:21 CET 2001


Pearu Peterson wrote:
> Note: I am not interested in converting the 'from-import' statements to
> 'import' statements,

> This behavior is well-known and has, roughly speaking, the following
> explanation:
> >>> from A import *    --- imports also module B but only "partly": module
>                            A is not imported to module B.
> >>> from B import *    --- nothing is done because module B is already in
>                            sys.modules.
> >>> reload(sys.modules['B'])  --- is needed in order to fix the
>                            NameError: module B will be imported
>                            "completely".

if you don't understand how things work today, are you
really the right person to suggest changes?

Cheers /F





More information about the Python-list mailing list