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.

Level: intermediateTopic: Python advanced

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.