# libtmux.Client.attached_session

- **Module:** libtmux
- **Package:** libtmux
- **Language:** Python
- **Kind:** property
- **Source:** https://github.com/tmux-python/libtmux/blob/38e368c11117fb4aeb2f082d552cd4f210eae06a/src/libtmux/client.py#L126
- **Page:** https://libtmux.org/en/py/stable/reference/libtmux-client-attached_session/

```
libtmux.Client.attached_session(self) -> Session | None
```

Return the :class:`Session` this client is currently attached to.

Re-reads the client from [`list-clients`](/en/tmux/latest/manual/list-clients/) before resolving, so the
returned :class:`Session` reflects the client's *live* attachment
rather than the snapshot captured when this :class:`Client` was
read. Returns ``None`` when tmux no longer reports this
[`client_name`](/en/tmux/latest/catalog/formats/client_name/) through [`list-clients`](/en/tmux/latest/manual/list-clients/), when the client is not
attached to any session, or when the snapshot [`session_id`](/en/tmux/latest/catalog/formats/session_id/) no
longer names a live session.

## Examples

```python
>>> with control_mode() as ctl:
...     client = server.clients.get(client_name=ctl.client_name)
...     attached = client.attached_session
>>> attached is not None
True
```
