Top "Python-import" questions

For questions about importing modules in Python

How to import other Python files?

How do I import other files in Python? How exactly can I import a specific python file like import file.…

python python-import python-module python-packaging
Importing files from different folder

I have the following folder structure. application ├── app │   └── folder │   └── file.py └── app2 └── some_folder └── some_file.py I want to …

python importerror python-import
Python error "ImportError: No module named"

Python is installed in a local directory. My directory tree looks like this: (local directory)/site-packages/toolkit/interface.py My …

python importerror python-import
ImportError: No module named requests

Whenever I try to import requests, I get an error saying No module Named requests. import requests The error I …

python python-requests python-import
How to import the class within the same directory or sub directory?

I have a directory that stores all the .py files. bin/ main.py user.py # where class User resides dir.…

python python-import
How to import a module given the full path?

How can I load a Python module given its full path? Note that the file can be anywhere in the …

python configuration python-import python-module
Import a module from a relative path

How do I import a Python module given its relative path? For example, if dirFoo contains Foo.py and dirBar, …

python relative-path python-import
Importing modules from parent folder

I am running Python 2.5. This is my folder tree: ptdraft/ nib.py simulations/ life/ life.py (I also have __init__.…

python module path directory python-import
ImportError: Cannot import name X

I have four different files named: main, vector, entity and physics. I will not post all the code, just the …

python python-import importerror circular-dependency
How do I unload (reload) a Python module?

I have a long-running Python server and would like to be able to upgrade a service without restarting the server. …

python module reload python-import