Use ship commands to open panes, send work and read the results. Commands take explicit IDs, so changing your selection doesn't redirect a script.
ship pane get --pane "$PANE" | jq .process # inspect a pane as JSONship pane read --pane "$PANE" --lines 40 # read its output as textCommands that return tabs, panes or views print JSON, pane read prints text, and commands with no result, such as closing a pane or sending without --wait, print nothing on success. Command errors explains failures.
In these examples, $PANE holds an ID from ship pane create or ship tab list, and jq reads fields from JSON. Inside a Ship pane, you can leave out --pane to target that pane, not whichever pane gets selected next.
Tab, pane and view commands start the named server if it isn't running, just like bare ship. To check without starting one, use ship server status. Passing --server-url also connects only and never starts a server.