# \_\_init_subclass\_\_

say it: **“DUN-der IN-it SUB-klas”** **/ˈdʌndər ˈɪnɪt ˈsʌbˌklæs/**

Runs whenever a class inherits from yours; handy for tracking child classes.

## What does `__init_subclass__` do?

`__init_subclass__` runs whenever someone makes a class that inherits from yours. It's a simple way to keep track of, or check, every child class without a metaclass.

```python
class Plugin:
    registry = []

    def __init_subclass__(cls):
        super().__init_subclass__()
        Plugin.registry.append(cls.__name__)

class PdfExport(Plugin):
    pass

print(Plugin.registry)  # ['PdfExport']
```

Level: Master · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=5)

Updated: November 17, 2026

Source: https://www.ask-codey.com/glossary/init-subclass
