# window.Window.session

- **Module:** window.Window
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/window/navigation.rs#L263
- **Page:** https://libtmux.org/en/rs/latest/reference/window-window-session/

```
window.Window.session(self) -> Result<Option<Session>, Error>
```

Return the session this window was reached through.

This re-reads tmux rather than the snapshot, so a session renamed or
removed since discovery is reported as it is now. `Ok(None)` means the
session no longer exists.

# Errors

Returns an error when the session listing fails.
