Importing two modules of same name

Tim Johnson tim at
Tue Feb 9 18:23:04 EST 2016

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/ is the following:

from config import config

imports the config dictionary from  /some/dir/sites/flask/

(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

That entails having two modules name config
one at /some/dir/sites/flask/
and the other at /some/dir/sites/flask/app/

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.

Platform - python 2.7 on Ubuntu 14.04. 
Experience: long-time python CGI programmer before retiring about 3
years ago.


More information about the Python-list mailing list