# libtmux.Window.respawn

- **Module:** libtmux.Window
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/036c521c4b83ce6e434eb50afe2a0d08a6a05e46/src/libtmux/window.py#L1101
- **Page:** https://libtmux.org/reference/py/libtmux-window-respawn/

```
libtmux.Window.respawn(self, shell: str | None = None, start_directory: StrPath | None = None, environment: dict[str, str] | None = None, kill: bool | None = None) -> None
```

Respawn the window process via ``$ tmux respawn-window``.

## Parameters

- `self`
- `shell` (str | None) — Shell command to run in the respawned window.
- `start_directory` (StrPath | None) — Working directory for the respawned window (``-c`` flag).
- `environment` (dict[str, str] | None) — Environment variables (``-e`` flag).
- `kill` (bool | None) — Kill the current process before respawning (``-k`` flag).
Required if the window is still active.

## Example

```python
>>> window = session.new_window(window_name='respawn_test')
>>> window.respawn(kill=True, shell='sh')
```
