Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Johnson Newsgroups: comp.lang.python Subject: Re: Importing two modules of same name Date: Wed, 10 Feb 2016 10:26:48 -0900 Organization: AkWebsoft Lines: 19 Message-ID: References: <20160209232303.GC2583@mail.akwebsoft.com> <56BA7809.1000206@oddbird.net> <87y4atngot.fsf@handshake.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.uni-berlin.de zd/+aGfme7AsRpu7fV+IsgNLoODrallea5+i8kvv7hsg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'builtin': 0.07; 'omit': 0.07; 'subject:two': 0.07; 'globals': 0.09; 'parameter.': 0.09; 'subject:modules': 0.09; 'subject:same': 0.09; 'python': 0.10; 'received:io': 0.16; 'received:psf.io': 0.16; 'config': 0.18; 'thanks.': 0.18; 'default,': 0.22; 'parameter': 0.22; 'import': 0.24; 'tim': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'specify': 0.27; 'function': 0.28; 'developing': 0.28; 'cgi': 0.29; 'indirectly': 0.29; 'sites.': 0.29; 'allows': 0.30; 'there': 0.36; 'framework': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'to:addr:python.org': 0.40; 'meyer': 0.84; 'package"': 0.91 Mail-Followup-To: python-list@python.org Content-Disposition: inline In-Reply-To: <87y4atngot.fsf@handshake.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:102770 * dieter [160209 23:03]: > Carl Meyer writes: > > ... > > If you omit the future-import in Python 2.7, `import config` will import > > the neighboring app/config.py by default, and there is no way to import > > the top-level config.py. > > There is the "__import__" builtin function which allows to specify > the "parent package" indirectly via its "globals" parameter. This > way, you can import the "top-level" config (passing an empty "globals"). Thanks. I used __import__ as part of a custom load() function that I used in my own framework when I was developing CGI sites. I never used the globals parameter tho'. If I start -- Tim http://www.akwebsoft.com, http://www.tj49.com