relative import
An import inside a package that names a sibling module with a leading dot, such as from .helpers import tidy, instead of the full package path.
In more detail
Absolute imports, from mypkg import helpers, are clearer and work the same everywhere, which is why the course prefers them. Relative imports only work inside a package, not in a file run directly as a script.
Related terms
- import statement — A statement that makes code from another module or package available by name in the current file.
- package — A folder of Python modules that can be imported as a group, or a distributable bundle of Python code installed with pip.
Taught in
- Packages, And Your Own Library — Hands-on Python: Complete Video Course & Book