Top "Python-import" questions

For questions about importing modules in Python

Local import statements in Python

I think putting the import statement as close to the fragment that uses it helps readability by making its dependencies …

python python-import
Python relative-import script two levels up

I've been struggling with imports in my package for the last hour. I've got a directory structure like so: main_…

python python-3.x python-import directory-structure relative-import
boto3 python 2.7 ImportError: No module named boto3 USER_BASE USER_SITE site packages doesn't exist

Why python is not finding boto3 when pip or pip3 shows it's installed. I'm on Mac machine. Tried pip/pip3 …

python macos pip python-import boto3
ImportError : cannot import name urlopen

I am trying to open up an URL for my project and here is my code: from urllib2 import urlopen …

python python-import importerror urlopen
Python: import the containing package

In a module residing inside a package, i have the need to use a function defined within the __init__.py …

python module package python-import
Trying to import module with the same name as a built-in module causes an import error

I have a module that conflicts with a built-in module. For example, a myapp.email module defined in myapp/email.…

python python-import
ImportError: No module named 'flask.ext'

When I import a Flask extension like this, it works fine: from flask_module import Module So the extension is …

python flask python-import importerror
Import module works in terminal but not in IDLE

I am trying to import pyodbc module on a windows computer. It works in the terminal, but not the IDLE. …

python module terminal python-import python-idle
"ImportError: No module named..." when importing my own module

I am trying to import a module and I keep getting an ImportError. In the PortfolioStatus.py file I have …

python python-2.7 python-import pythonanywhere
relative path not working even with __init__.py

I know that there are plenty of similar questions on stack overflow. But the common answer doesn't seem to be …

python import package python-import importerror