AI engineering glossary · Python advanced

What is __init__.py?

__init__.py: A file that marks a directory as a regular Python package and runs when the package is imported. It can be empty or expose selected names so users import them from the package directly.

Level: intermediateTopic: Python advanced

__init__.py: an example

Adding from .cleaning import clean_text to mypkg/__init__.py lets users write from mypkg import clean_text.

Related terms

More Python advanced terms

Where you learn it

__init__.py 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.