Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'attribute': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'a.py': 0.16; 'c.py': 0.16; 'identifier': 0.16; 'subject:Question': 0.19; '(most': 0.21; 'traceback': 0.24; 'work.': 0.27; 'import': 0.27; 'tried': 0.27; 'does': 0.32; 'that,': 0.32; 'error.': 0.32; 'object': 0.33; 'file': 0.34; 'header:X-Complaints-To:1': 0.34; 'last):': 0.34; 'to:addr:python-list': 0.35; 'received:org': 0.36; 'run': 0.37; 'but': 0.37; 'skip:" 10': 0.37; 'to:addr:python.org': 0.40; 'follow': 0.61; 'choose': 0.64; 'frank': 0.64; 'received:41': 0.71 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: "Frank Millman" Subject: Re: Question about circular imports Date: Mon, 27 Feb 2012 08:16:47 +0200 References: X-Gmane-NNTP-Posting-Host: 41-135-111-160.dsl.mweb.co.za X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.4657 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4913 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1330323422 news.xs4all.nl 6869 [2001:888:2000:d::a6]:53618 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20923 > > To avoid the tedious reference, follow this with > read = sound.formats.wavread # choose the identifier you prefer > @Terry and OKB I tried that, but it does not work. a.py /b __init__.py c.py d.py a.py - from b import c c.py - import b.d d.py - import b.c If I run a.py, it returns with no error. c.py - import b.d d = b.d d.py - import b.c c = b.c If I run a.py, I get Traceback (most recent call last): File "F:\tests\a.py", line 1, in from b import c File "F:\tests\b\c.py", line 1, in import b.d File "F:\tests\b\d.py", line 2, in c = b.c AttributeError: 'module' object has no attribute 'c' I get the same if I try 'import b.c as c'. Frank