Most pythonic way to import all objects in a module as their name in the module

python, python-import

Solution

This would import everything from modules as their name:

from module import *

But it's not really good practice. Import only what is really needed and use PEP8 tests for your code.

Problem

When you import a module, python protects the namespace by importing all objects in that module as `module.objectname` instead of `objectname`. `import module.objectname as objectname` will import the object as its original name in the module, but writing out every object in this manner would be tedious for a large module. What is the most pythonic way to import all objects in a module as their name within the module?

Original source