# libtmux.Session.__exit__

- **Module:** libtmux.Session
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/9fdd083a8181a827889337b63cd4e6daea661a8c/src/libtmux/session.py#L129
- **Page:** https://libtmux.org/en/py/latest/reference/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
