# libtmux.Session.__exit__

- **Module:** libtmux.Session
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/036c521c4b83ce6e434eb50afe2a0d08a6a05e46/src/libtmux/session.py#L129
- **Page:** https://libtmux.org/reference/py/libtmux-session-__exit__/

```
libtmux.Session.__exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: types.TracebackType | None) -> None
```

Exit the context, killing the session if it exists.

## Parameters

- `self`
- `exc_type` (type[BaseException] | None) — The type of the exception that was raised
- `exc_value` (BaseException | None) — The instance of the exception that was raised
- `exc_tb` (types.TracebackType | None) — The traceback of the exception that was raised
