DocumentationDocumentation
User guide/Actions, state, and events

Connect your interface to Blender

The page sends actions, Python executes the logic, and results and state return to the interface.

The path of an operation

  1. The user clicks a page button; the page gathers arguments.
  2. The page asynchronously calls a registered action.
  3. Python validates arguments and scene conditions, performs work, and returns serializable results.
  4. The page shows success or failure; affected state is invalidated.
  5. Subscribers receive authoritative snapshots and update lists or panels.

Choose actions, state, or events

Need Use Why
Click to create or modify Action A request needs arguments, a result, and failure handling.
Show the current object or progress State Newly opened pages can read current facts too.
Notify that a task just finished Event Describes an occurrence, not persistent data.
Show an image or file Resource references Pass a reference, then read content as needed instead of sending local paths.

Start read-only, then add changes

Start with Build your first add-on to read the scene. Confirm a trusted local window, registration after binding, and matching names on both sides. Then follow Call Python to add application arguments.

Once a call works, use State subscriptions to avoid repeated manual reads. For Blender-side changes, connect known data-change notifications to invalidate. The framework does not observe all application data automatically.

Distinguish business rejection from communication failure

No active object may be a normal application rejection. Missing registration, invalid connections, or unencodable arguments may reject an asynchronous call. Explain both cases instead of only disabling a button or always reporting success.

Return JSON-compatible strings, numbers, booleans, arrays, objects, or null, not Blender objects, path objects, or vectors. Handlers run on Blender's main thread; long loops block the UI. Page-side await does not move Python into the background.

Verify a real end-to-end path

  • First opening reads the actual scene, not demo constants.
  • After an action changes data, its result matches the actual object.
  • Changes through Blender's own controls reach the page through state refresh.
  • Repeated opening does not duplicate subscriptions or execution.

For events and disconnection, see Events and connection status.

Based on the actions/state guide and communication protocol.

Back to User guide · All topics