Problem with modules refering to each other

Darrell news at
Sun Aug 8 18:21:49 CEST 1999

I think this is one of those things I had to forget about from
the world of 'C'. In Python you don't need to have an object
defined by some .H file to use it. Besides circular reverences
importing this way isn't much different than having one large

As you know one large module isn't a nice thing.

Try something like passing a parm that allows access to
an object in another module. The parameter approach also
allows you to change the relationships of these modules
at runtime.

Decoupling from other modules is a good thing.


Phil Hunt <philh at> wrote in message
news:934075710snz at
> I have two python modules, both of which need to refer to classes
> defined in the other one. How do I do this?
> I am currently putting at the start of each module a line of the form:
>    from theOtherModule import *
> However, this is not working. My modules -- greatly simplified -- look
> like this:
>    from hhh import *
>    ti = AnHhhClass()
>    print ti
> and:
>    from bak import *
>    class AnHhhClass: pass
> When I run ``python'', I get the error message
> ``NameError: AnHhhClass''.
> --
> Phil Hunt....philh at

More information about the Python-list mailing list