Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102736 > unrolled thread

Importing two modules of same name

Started byTim Johnson <tim@akwebsoft.com>
First post2016-02-09 14:23 -0900
Last post2016-02-09 14:23 -0900
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Importing two modules of same name Tim Johnson <tim@akwebsoft.com> - 2016-02-09 14:23 -0900

#102736 — Importing two modules of same name

FromTim Johnson <tim@akwebsoft.com>
Date2016-02-09 14:23 -0900
SubjectImporting two modules of same name
Message-ID<mailman.1.1455060587.7749.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web