# libtmux.Session.kill_window

- **Module:** libtmux
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/38e368c11117fb4aeb2f082d552cd4f210eae06a/src/libtmux/session.py#L944
- **Page:** https://libtmux.org/en/py/stable/reference/libtmux-session-kill_window/

```
libtmux.Session.kill_window(
    self, target_window: str | int | None = None
) -> None
```

Close a tmux window, and all panes inside it, [`$ tmux kill-window`](/en/tmux/latest/manual/kill-window/).

Kill the current window or the window at ``target-window``. removing it
from any sessions to which it is linked.

## Parameters

- `target_window` (`str | int | None`): Window to kill.

## Raises

- [`libtmux.exc.LibTmuxException`](/en/py/stable/reference/libtmux-exc-libtmuxexception/): If tmux returns an error.

## In other ports

### Close a window named from its session

- Go: [`tmux.Session.KillWindow`](/en/go/latest/reference/tmux-session-killwindow/) (method)
- C#: [`LibTmux.Session.KillWindowAsync`](/en/csharp/latest/reference/libtmux-session-killwindowasync/) (method)
