# Evaluate in a workspace

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

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

`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`, `session`, `window` and `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/csharp/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-dotnet/blob/f77fe776ba67a04abb20ddbbc26cf4a000d63b74/src/LibTmux.Workspace.Cli/README.md).
