# libtmux.Window.move_window

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

tmux command: [`move-window`](/en/tmux/latest/manual/move-window/)

```
libtmux.Window.move_window(
    self,
    destination: str = "",
    session: str | None = None,
    after: bool | None = None,
    before: bool | None = None,
    no_select: bool | None = None,
    kill_target: bool | None = None,
    renumber: bool | None = None,
) -> Window
```

Move current :class:`Window` object [`$ tmux move-window`](/en/tmux/latest/manual/move-window/).

## Parameters

- `destination` (`str`): The ``target window`` or index to move the window to, default:
empty string.
- `session` (`str | None`): The ``target session`` or index to move the window to, default:
current session.
- `after` (`bool | None`): Insert after the target window (``-a`` flag). (added 0.56)
- `before` (`bool | None`): Insert before the target window (``-b`` flag). (added 0.56)
- `no_select` (`bool | None`): Do not make the moved window the current window (``-d`` flag). (added 0.56)
- `kill_target` (`bool | None`): Kill the target window if it exists (``-k`` flag). (added 0.56)
- `renumber` (`bool | None`): Renumber all windows in sequential order (``-r`` flag). This is a
standalone operation — when used, no move is performed and other
parameters are ignored. (added 0.56)

## Returns

:class:`Window`
    Self, for method chaining.

## Raises

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

## In other ports

### Move a window to another session or index

- Lua: [`libtmux.WindowLink:move`](/en/lua/latest/reference/libtmux-windowlink-move/) (method)
- TypeScript: [`window.Window.move`](/en/ts/latest/reference/window-window-move/) (method)
- Rust: [`window.Window.move_to`](/en/rs/latest/reference/window-window-move_to/) (method)
- Go: [`tmux.Window.Move`](/en/go/latest/reference/tmux-window-move/) (method)
- Java: [`io.github.libtmux.Window.Window.moveTo`](/en/java/latest/reference/io-github-libtmux-window-window-moveto/) (method)
- C#: [`LibTmux.Window.MoveAsync`](/en/csharp/latest/reference/libtmux-window-moveasync/) (method)
- C++: [`libtmux::Window::move_to`](/en/cxx/latest/reference/libtmux-window-move_to/) (method)
- Swift: [`Server.move(_:to:at:)`](/en/swift/latest/reference/server-move(_-to-at-)/) (method)
