AI engineering glossary · Python advanced
What is relative import?
Relative import: An import written with leading dots that names a module by its position relative to the current package, such as from . import utils. It keeps a package's internal imports working when the package is renamed.
Relative import: an example
Inside pkg/model.py, from .layers import Dense imports layers.py from the same package.
Related terms
More Python advanced terms
Where you learn it
Relative import is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.