[Tutor] reciprocal import

christopher.henk at allisontransmission.com christopher.henk at allisontransmission.com
Tue Dec 16 21:42:45 CET 2008


Although you generally would want to design so that this does not happen, 
if the import of the first module is only needed in some of the functions 
in the second module, you can include the import within the function 
definition and that would  work ok.
But you can't have the second import at the module level.

Chris




Steve Willoughby <steve at alchemy.com> 
Sent by: tutor-bounces+christopher.henk=allisontransmission.com at python.org
12/16/2008 03:08 PM

To
spir <denis.spir at free.fr>
cc
*tutor <tutor at python.org>
Subject
Re: [Tutor] reciprocal import






spir wrote:
> Is it legal or possible  at all for two modules to import each other? I
> tried several ways and had several kinds of error messages. Usually
> "can't import...".

My first impression here is that this sounds like a bad class/module 
design if they're really that interdependent.
_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081216/7b7e734a/attachment.htm>


More information about the Tutor mailing list