DocumentationDocumentation
User guide/Integration and entry points

Choose how users open the interface

Choose a sidebar, menu, or other entry point to fit the add-on's workflow, with predictable opening and closing behavior.

Put entry points where users will look

Location Best suited to Considerations
sidebar Frequently used small tools Use your add-on's category, not the official example category.
Top menu or viewport header Main tools or frequent entry points Use clear labels rather than icons users must guess.
Object context menu Object-context operations Show only in the relevant editor and mode.
Keyboard shortcuts Experienced users with established workflows Check conflicts and allow changes in preferences.
Automatic opening Explicitly required startup display Wait for editor context; do not open directly during registration.

Choose open-only or toggle behavior

Open keeps an already visible window. Toggle opens on the first click and closes on the second; sidebar buttons commonly use this. Multiple entry points can share declarations and helpers without changing an existing open-only entry into a toggle.

Do not simulate closing by replacing windows or generate a new key on every click. Reuse complete toggle handling from Operator from the starter tutorial.

Add a button to an existing sidebar

Place this fragment in your own panel class. Replace my_addon.open_window with the actual registered operator ID. The fragment creates no operator and does not replace register/unregister.

Existing panel draw method
python
def draw(self, context):
    ui.draw_web_runtime_notice(self.layout)
    self.layout.operator("my_addon.open_window", text="打开 / 关闭工具")

ui comes from your add-on's .nexus_web. Show runtime unavailability first; the button can still trigger installation guidance. Do not bind or open in panel drawing.

Pair registration with removal

  1. Register the framework before operators and panels.
  2. Remove appended menu callbacks on unload. Retain actual keymap items and remove each one.
  3. Automatic opening needs a valid window/editor context and an open-only function. Cancel pending timers on unload.
  4. Remove entry points, release clients, then unregister the framework.

A user button is simplest when automatic opening is unnecessary. For the full sequence, see Registration, binding, and cleanup.

Verify each entry's intended meaning

From closed, three toggle clicks should open, close, and reopen. After page-side closing, the entry should reopen. Repeated open-only calls should retain the window. Check shortcuts with and without page focus. See Input and focus.

Based on entry-point, window, and template documentation.

Back to User guide · All topics