Home Installation Node Reference Radiance Viewer Scripting Tutorials FAQ Changelog Architecture

Python Scripting Terminal

Professional terminal console for live Python debugging, node manipulation, and advanced control within Radiance Viewer.

Terminal Overview

Radiance Viewer includes an integrated professional command-line interface directly within the viewer pane. Much like Nuke's script editor, this enables Technical Directors (TDs) and power users to write Python scripts, toggle viewer states, and inspect execution metrics without disrupting their workflow.

New in v2.3.3: Terminal HUD Tab

The viewer now features a dedicated TERMINAL tab in the bottom dock, alongside the original Script Editor. This new HUD tab provides a live, stateful Python REPL (Read-Eval-Print Loop) environment for interactive development.

What makes this terminal system special is that it serves as a bridge. It has native commands for controlling the viewer visually, but any non-native commands are passed over WebSocket/API directly to the ComfyUI Python backend, captured, executed, and the outputs are returned to the screen.

Accessing the Terminal

By default, the terminal sits collapsed at the bottom of the Radiance Pro Viewer Right-Control-Panel. You can toggle it via hotkey or mouse.

Action Method
Toggle Terminal Visibility Press ` or ~ while the viewer is focused.
Toggle via UI Click the collapsing caret on the terminal header block.
Execute Command Press Enter to execute. Press Shift + Enter for multi-line input.
Command History Press and arrows to cycle through previous commands.
Autocomplete Navigation Press Tab to cycle through matching native commands and aliases.

Backend Python Execution

If you type any command that is not captured by the viewer natively, the Javascript client serializes your input and fires an API POST request to the /radiance/terminal endpoint configured on the ComfyUI PromptServer.

FXTD ❯print("Hello from the Radiance Terminal!")
← Hello from the Radiance Terminal!

FXTD ❯import sys; print(f"Python Version: {sys.version.split()[0]}")
← Python Version: 3.10.12

Tracebacks & Safety

The terminal catches exceptions. If you execute malformed Python or throw an exception, the traceback will be safely captured and dumped to the viewer console in red text, rather than crashing your ComfyUI sever.

Execution Context

To save time, the exec() namespace comes pre-loaded with access to several useful libraries that are common in Visual FX workflows. You do not need to import them.

  • math — The standard Python math library.
  • os — The standard Python OS interaction library.
  • np — Globally imported numpy.
  • torch — PyTorch library for manipulating tensors.
  • json — JSON parsing and serialization (New in v2.3.3).
  • folder_paths — ComfyUI path management.
# We can use np and math out of the box
FXTD ❯print(math.pi * np.random.rand())
← 2.14159265...

Native Viewer Commands

The terminal has native visual interaction commands that do not get sent to the Python API over the network. They run locally in JavaScript modifying the LiteGraph/Canvas states instantly.

Command Description
help Lists all available commands.
status Shows viewer dimensions, rendering active status, active LUTs, and color grading parameters.
lut [name] Changes the active display LUT. E.g. lut sRGB. Use lut list to view all.
grade save/reset Save current grade to a memory slot, or reset all adjustments to 0.
exposure [num] Sets global exposure explicitly. Works for gamma/sat/gain as well.
export [name] Takes a 16-bit PNG frame capture of the current viewer canvas state directly to your downloads.
alias [nm] "[cmd]" Create a custom shortcut. Assign to startup to run automatically on load.
record [start/stop] Starts macro recording. record stop [name] saves it as a new alias.
ls [nodes/sel] Lists all instantiated graph nodes, or only the currently selected ones.
find [query] Locates, highlights, and centers the graph on a node matching the ID or title.
doc [python_obj] Fetches and prints the python docstring for a backend module or object.
clear Wipes the terminal history view.

Custom Aliases

You can create custom shortcuts for frequently used commands using the alias command. Aliases are saved persistently in your browser's local storage.

FXTD ❯alias reset_view "zoom fit; grade reset"
← [Alias] Created alias 'reset_view'

# Now you can use it anytime
FXTD ❯reset_view

To use an alias, simply type its name in the terminal. The terminal engine will expand it automatically.

JavaScript DOM/Graph Access

The eval command allows you to execute arbitrary JavaScript directly within the context of the browser. This is incredibly powerful for TDs who want to manipulate the ComfyUI LiteGraph instance, query node states, or modify the UI without reaching for the developer console.

Warning: Advanced Feature

Executing raw JavaScript can break the ComfyUI session if you modify the internal graph state incorrectly. Proceed with caution.

# Print the total number of instantiated nodes in the workflow
FXTD ❯eval app.graph.computeExecutionOrder(false).length
← 42

# Turn the background color of the first node red and refresh
FXTD ❯eval app.graph._nodes[0].bgcolor = "#ff0000"; app.graph.setDirtyCanvas(true,true);

Advanced Recipes & Workflows

Here are some practical examples of how Technical Directors can use the terminal to accelerate their VFX workflow in Radiance.

1. Look-Dev Hot Swapping (Native)

Quickly test look combinations using native commands without touching the mouse, then save the state.

# Switch LUT, bump gamma, push red printer lights, and export frame
FXTD ❯lut ARRI LogC3; gamma 1.1; printer r 5; export look_dev_v1

# Save that grade into memory slot 'hero_look'
FXTD ❯grade save hero_look

2. Tensor Shape Debugging (Python)

When writing custom Radiance nodes, you can globally expose your image tensors to Python's sys.modules and inspect them live from the viewer.

FXTD ❯import sys; tensor = sys.modules['my_debug'].latest_tensor
FXTD ❯print(f"Batch: {tensor.shape[0]}, Res: {tensor.shape[1]}x{tensor.shape[2]}")
← Batch: 1, Res: 1920x1080

3. Automating Render Queues (Javascript via Eval)

You can trigger ComfyUI's internal queue API directly via JS script injection to bypass the Queue Prompt button.

FXTD ❯eval app.queuePrompt(0, 1)
← (Triggers a render on the backend)