Top "Python-import" questions

For questions about importing modules in Python

Why is "import *" bad?

It is recommended to not to use import * in Python. Can anyone please share the reason for that, so that …

python python-import
How does python find a module file if the import statement only contains the filename?

Everywhere I see Python code importing modules using import sys or import mymodule How does the interpreter find the correct …

python python-import python-module pythonpath
How to gracefully deal with failed future feature (__future__) imports due to old interpreter version?

How do you gracefully handle failed future feature imports? If a user is running using Python 2.5 and the first statement …

python python-import
Attempted relative import beyond toplevel package

Here is my folder structure: Mopy/ # no init.py ! bash/ __init__.py bash.py # <--- Edit: yep there is …

python python-2.7 python-import python-unittest relative-import
What are good rules of thumb for Python imports?

I am a little confused by the multitude of ways in which you can import modules in Python. import X …

python python-import
Python Nose Import Error

I can't seem to get the nose testing framework to recognize modules beneath my test script in the file structure. …

python nose python-import
When to use os.name, sys.platform, or platform.system?

As far as I know, Python has 3 ways of finding out what operating system is running on: os.name sys.…

python operating-system python-import
Absolute vs. explicit relative import of Python module

I'm wondering about the preferred way to import packages in a Python application. I have a package structure like this: …

python package python-import
Python: reload component Y imported with 'from X import Y'?

In Python, once I have imported a module X in an interpreter session using import X, and the module changes …

python python-import
Importing modules in Python - best practice

I am new to Python as I want to expand skills that I learned using R. In R I tend …

python coding-style workflow python-import