Importing two modules of same name
Tim Johnson
tim at akwebsoft.com
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/__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
More information about the Python-list
mailing list