Starting from Python 3.1, you can use importlib :
import importlib
foobar = importlib.import_module("foo-bar")
More Related Contents:
- `from … import` vs `import .` [duplicate]
- Adding a module (Specifically pymorph) to Spyder (Python IDE)
- Import module from subfolder
- Python: importing a sub‑package or sub‑module
- Can’t import my own modules in Python
- Can’t import my own modules in Python
- How to import all submodules?
- Modules are installed using pip on OSX but not found when importing
- Python module with a dash, or hyphen (-) in its name
- How to change a module variable from another module?
- Use a library locally instead of installing it
- How does Python importing exactly work?
- How to access a standard-library module in Python when there is a local module with the same name?
- How to import a Python module from a sibling folder?
- How to import a module in Python with importlib.import_module
- What could cause a python module to be imported twice?
- Namespaces with Module Imports
- How to prevent a module from being imported twice?
- ImportError on python 3, worked fine on python 2.7
- Python import mechanics
- Python importing a module from a parallel directory
- How to make global imports from a function?
- how to test if one python module has been imported?
- from … import OR import … as for modules
- Relative import in Python 3 is not working [duplicate]
- Flask(‘application’) versus Flask(__name__)
- python import module from parent package
- How to reference python package when filename contains a period
- Why is Python running my module when I import it, and how do I stop it?
- Python: Why should ‘from import *’ be prohibited?