Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Tim Johnson Newsgroups: comp.lang.python Subject: Importing two modules of same name Date: Tue, 9 Feb 2016 14:23:04 -0900 Organization: AkWebsoft Lines: 35 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.uni-berlin.de UTqY88Z5e+hgr/eHJBn1IgLUKtlrv9tzVOm9+p85BycQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:two': 0.07; 'imports': 0.09; 'satisfy': 0.09; 'subject:modules': 0.09; 'subject:same': 0.09; 'python': 0.10; '2.7': 0.13; ':))': 0.16; '__init__.py': 0.16; 'long-time': 0.16; 'practices.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'app': 0.16; 'config': 0.18; 'programmer': 0.18; '(the': 0.22; 'import': 0.24; 'tim': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'cgi': 0.29; 'dictionary': 0.29; 'experience:': 0.29; 'tutorial': 0.29; 'realize': 0.32; 'problem': 0.33; 'skip:/ 20': 0.33; 'ubuntu': 0.33; 'this?': 0.34; 'add': 0.34; 'modules': 0.36; 'to:addr :python-list': 0.36; 'two': 0.37; 'thanks': 0.37; 'charset:us- ascii': 0.37; 'wanted': 0.37; 'application': 0.39; 'to:addr:python.org': 0.40; 'ago.': 0.61; 'developed': 0.66; 'past.': 0.66; 'skip:/ 30': 0.84 Mail-Followup-To: Python ML Content-Disposition: inline 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:102736 Before proceding, let me state that this is to satisfy my curiousity, not to solve any problem I am having. Scenario : Web application developed at /some/dir/sites/flask/ If I have a package - let us call it app and in my /some/dir/sites/flask/app/__init__.py is the following: from config import config imports the config dictionary from /some/dir/sites/flask/config.py (the real-case scenario is M. Grinberg's tutorial on Flask). What if I wanted to add a module in the app package and call it from __init__.py That entails having two modules name config one at /some/dir/sites/flask/config.py and the other at /some/dir/sites/flask/app/config.py What would be the proper way to do this? (If proper at all :)) I realize that it may not be best practices. And is a practice that I avoided in the past. FYI: Platform - python 2.7 on Ubuntu 14.04. Experience: long-time python CGI programmer before retiring about 3 years ago. Thanks -- Tim http://www.akwebsoft.com, http://www.tj49.com