Jan 26, 2026
# Chapter 9 — Modules, Packages, and Import (Organize Your Code)
This chapter uses “house rooms” as a metaphor.
## 9.1 One File = One Room
If `math_tools.py` has functions, you import them:
```python
from math_tools import add
print(add(1, 2))
```
## 9.2 Packages (A Folder That Acts Like a Module)
```text
src/
meetcode_tools/
__init__.py
text.py
numbers.py
```
Import:
```python
from meetcode_tools.text import clean
```
## 9.3 The Most Common “Import Error” Cause
You ran Python from the wrong folder.
Fix: run from the project root, or adjust your `PYTHONPATH`, or install your package in editable mode.
---