Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'example:': 0.03; 'imports': 0.07; 'python': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; '__init__': 0.16; 'packet': 0.16; 'subject:import': 0.16; 'implicit': 0.23; 'import': 0.28; 'importing': 0.29; 'print': 0.29; 'module': 0.30; 'modules': 0.31; 'hi,': 0.32; 'to:addr:python-list': 0.33; 'header:User-Agent:1': 0.34; 'skip:= 10': 0.34; 'project': 0.34; '2.6': 0.34; 'subject: ?': 0.34; 'header:X-Complaints-To:1': 0.35; 'certain': 0.35; 'starting': 0.36; 'subject:skip:p 10': 0.37; 'received:org': 0.38; 'non': 0.38; 'under': 0.39; 'header:Mime-Version:1': 0.39; 'empty': 0.39; 'to:addr:python.org': 0.39; "i'd": 0.40; 'full': 0.63; 'due': 0.66; 'subject:without': 0.67 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Gelonida N Subject: import packet.module without importing packet.__init__ ? Date: Sun, 11 Sep 2011 02:05:13 +0200 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: unicorn.dungeon.de User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.21) Gecko/20110831 Lightning/1.0b2 "" 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: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1315699526 news.xs4all.nl 2428 [2001:888:2000:d::a6]:49723 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:13093 Hi, I am little shaky with how exactly python imports packages / modules etc. Is it possible to import a module from a packet without importing its __init__.py ? Full example: ============== # application.py --------------------- print "starting application" import mypacket.module1 # mypacket.__init__.py --------------------- print "importing __init__" # mypacket.module1.py --------------------- print "importing module1" The output, that I get with python 2.6 is $ python application.py > starting application > importing __init__ > importing module1 Under certain circumstances I'd like to avoid the implicit import of __init__.py Due to other constrains of my project I am obliged to have a non empty __init__.py