Python how to alias module name (rename with preserving backward compatibility)
I have a python package named foo , which i use in imports: import foo.conf from foo.core import Something Now i need to rename the foo module into something else, let's say bar , so i want to do: import bar.conf from bar.core import Something but i want to maintain backward compatibility with existing code, so the old ( foo. ) imports should work as well and do the same as the bar. imports. How can this be accomplished in python 2.7? This forces you to keep a foo directory, but I think it the best way to get this to work. Directory setup: bar ├── __init__.py └── baz.py foo └── __init__.py foo