# Evaluate in a workspace

Source: https://libtmux.org/en/ts/latest/workspace/cli/shell/

> Use the optional Python runtime to inspect a workspace through the native command.

**Workspace Manager concept example** A working example of the core library. It can change without notice.



`tmux-workspace shell` opens the optional Python inspection environment for a
loaded session. Code passed to `-c` executes in that environment, with tmux
objects such as [`server`](<https://libtmux.org/en/ts/latest/reference/#server>), [`session`](<https://libtmux.org/en/ts/latest/reference/#session>), [`window`](<https://libtmux.org/en/ts/latest/reference/#window>) and [`pane`](<https://libtmux.org/en/ts/latest/reference/#pane>) available.

## Runtime requirement

Install tmuxp 1.74.0 in a separate Python environment and set
`TMUX_WORKSPACE_PYTHON` to that environment's Python executable. The native CLI
checks the runtime before evaluating code. Ordinary workspace loading does
not require this inspection runtime.

## Evaluate with a selected server

Continue the [installation walkthrough](https://libtmux.org/en/ts/latest/workspace/guides/installation/) through its
detached load. Select its socket, session and window:

```console
$ tmux-workspace shell \
    -S "$WORKSPACE_TMP/tmux.sock" \
    -c 'print(pane.pane_id)' \
    --json \
    workspace-guide editor
```

The result includes captured output and child status. Check the command's exit
status before consuming it. An interactive shell needs a terminal; use `-c`
when stdout belongs to automation.

`shell --help` lists backend and startup choices. Optional shell backends must
be installed in the selected Python environment.

[CLI source](https://github.com/libtmux/libtmux-ts/blob/f36d692552bb9a373b45338bb5fece854e57cc3d/packages/workspace-cli/README.md).
