Development docsHookeUI guide
Methods and tools

Python scripts and notebooks

Run code in the current scientific session and save scientific changes separately.

View Markdown

The scientific Python panel belongs to an opened, prepared scientific session. It operates on that session's data and variables; it does not select an unrelated terminal Python environment.

Review and run a script

Open the correct session

Open the retained scientific document, then Controls → Open saved view → Python. Check the Project, saved input and private session before running code.

Enter or load the code

Use Python code, or Open Python script for a nonempty UTF-8 .py file up to 256 KiB. When a draft exists, choose Replace draft with this script or Keep current draft deliberately. Review code and its file/provider effects before executing it.

Run and inspect the outcome

Choose Run code. Inspect the cell's output, error and refreshed view. Complete name or Help for name supports session introspection; Ctrl+Space requests completion. Those name lookups are not AI provider calls.

Retain what you need

Download draft as .py exports script text only. Use the scientific Save controls to retain array changes or supported tool state. A visible Python history entry is not a saved scientific-data revision.

Interrupt or end a session

Interrupt code requests interruption while retaining variables and partial changes. A native call can need to return before interruption is observed. Stop Python session ends the session and discards its unsaved state; accepted Project data remains.

If execution is unconfirmed, it may already have run. Follow the instruction to stop that session before another execution rather than blindly retrying a possibly effective command. Earlier history and drafts can remain visible in a new session, but their code is not automatically replayed.

Connect local Jupyter

Where offered, open Connect a notebook, then its Connect a notebook action. Follow the app's displayed local kernelspec-install command and expiry, then select that displayed kernel in Jupyter on this Mac. Use the command shown by your current session rather than copying a stale command from a previous run.

Notebook cells execute in the same Hooke scientific session and enter its Python history. Revoke notebook connection ends that access. Reconnecting replaces the previous connection; stopping or replacing the private session ends it. Save scientific data explicitly before ending that session.

For ordinary image-analysis tasks without code, start with Run an analysis tool.

On this page