# libtmux.Window.unlink

- **Module:** libtmux.Window
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/9fdd083a8181a827889337b63cd4e6daea661a8c/src/libtmux/window.py#L1029
- **Page:** https://libtmux.org/en/py/latest/reference/libtmux-window-unlink/

```
libtmux.Window.unlink(self, kill_if_last: bool | None = None) -> None
```

Unlink this window from the current session via ``$ tmux unlink-window``.

## Parameters

- `self`
- `kill_if_last` (bool | None): Kill the window if it is the last window in the session (``-k``).

## Example

```python
>>> w = session.new_window(window_name='unlink_test')
>>> s2 = server.new_session(session_name='unlink_s2')
>>> w.link(s2)
>>> linked = [x for x in s2.windows if x.window_name == 'unlink_test']
>>> linked[0].unlink()
```
