Top "Python-import" questions

For questions about importing modules in Python

Python imports for tests using nose - what is best practice for imports of modules above current package

This is a question which is asked frequently in different forms, and often obtains "lol you're not doing it properly" …

python testing nose python-import
Error importing Polygon from shapely.geometry.polygon

In my Anaconda 2.2 64bit with Python 3.4.3 the following line works well: import shapely But the following line: from shapely.geometry.…

python python-import shapely
Why does my python not add current working directory to the path?

I keep seeing sites mentioning that the directory that you execute 'python ' get added to the python path. For …

python python-import
import vs __import__( ) vs importlib.import_module( )?

I noticed Flask was using Werkzeug to __import__ a module, and I was a little confused. I went and checked …

python python-import
python circular imports once again (aka what's wrong with this design)

Let's consider python (3.x) scripts: main.py: from test.team import team from test.user import user if __name__ == '__…

python dependencies class-design python-import
Python's __import__ doesn't work as expected

When using __import__ with a dotted name, something like: somepackage.somemodule, the module returned isn't somemodule, whatever is returned seems …

python python-import
Issues importing mlxtend python

I'm new to python, so apologies if this is a silly question. I'm trying to use mlxtend, and have installed …

python python-import importerror mlxtend
Relative imports with unittest in Python

I am trying to use Python unittest and relative imports, and I can't seem to figure it out. I know …

python python-import python-unittest
Callable modules

Why doesn't Python allow modules to have a __call__ method? (Beyond the obvious that it wouldn't be easy to import …

python module python-import
python import of local module failing when run as systemd/systemctl service

I have a python application that I'm tring to run as a system service. The application runs fine when I …

python python-import systemd