user: Show practical ways to work with Node Operators in a Blender add-on or script – include code.

assistant: # Node Operators

bpy.ops.node.activate_viewer()
:   Activate selected viewer node in compositor and geometry nodes

bpy.ops.node.add_closure_zone(*\**, *settings=None*, *use_transform=False*, *offset=(150.0, 0.0)*)
:   Add a Closure zone

    Parameters:
    :   - **settings** (`bpy_prop_collection` of `NodeSetting`, (optional)) – Settings, Settings to be applied on the newly created node
        - **use_transform** (*boolean**,* *(**optional**)*) – Use Transform, Start transform operator after inserting the node
        - **offset** (*float array* *of* *2 items in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Offset, Offset of nodes from the cursor when added

    File:
    :   [startup/bl_operators/node.py:633](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/node.py#L633)

bpy.ops.node.add_collection(*\**, *name=''*, *session_uid=0*)
:   Add a collection info node to the current node editor

    Parameters:
    :   - **name** (*string**,* *(**optional**,* *never None**)*) – Name, Name of the data-block to use by the operator
        - **session_uid** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Session UID, Session UID of the data-block to use by the operator

bpy.ops.node.add_color(*\**, *color=(0.0, 0.0, 0.0, 0.0)*, *gamma=False*, *has_alpha=False*)
:   Add a color node to the current node editor

    Parameters:
    :   - **color** (*float array* *of* *4 items in* *[**0**,* *inf**]**,* *(**optional**)*) – Color, Source color
        - **gamma** (*boolean**,* *(**optional**)*) – Gamma Corrected, The source color is gamma corrected
        - **has_alpha** (*boolean**,* *(**optional**)*) – Has Alpha, The source color contains an Alpha component

bpy.ops.node.add_empty_group(*\**, *settings=None*, *use_transform=False*)
:   Add a group node with an empty group

    Parameters:
    :   - **settings** (`bpy_prop_collection` of `NodeSetting`, (optional)) – Settings, Settings to be applied on the newly created node
        - **use_transform** (*boolean**,* *(**optional**)*) – Use Transform, Start transform operator after inserting the node

    File:
    :   [startup/bl_operators/node.py:534](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/node.py#L534)

bpy.ops.node.add_foreach_geometry_element_zone(*\**, *settings=None*, *use_transform=False*, *offset=(150.0, 0.0)*)
:   Add a For Each Geometry Element zone that allows executing nodes e.g. for each vertex separately

    Parameters:
    :   - **settings** (`bpy_prop_collection` of `NodeSetting`, (optional)) – Settings, Settings to be applied on the newly created node
        - **use_transform** (*boolean**,* *(**optional**)*) – Use Transform, Start transform operator after inserting the node
        - **offset** (*float array* *of* *2 items in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Offset, Offset of nodes from the cursor when added

    File:
    :   [startup/bl_operators/node.py:633](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/node.py#L633)

bpy.ops.node.add_group(*\**, *name=''*, *session_uid=0*, *show_datablock_in_node=True*)
:   Add an existing node group to the current node editor

    Parameters:
    :   - **name** (*string**,* *(**optional**,* *never None**)*) – Name, Name of the data-block to use by the operator
        - **session_uid** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Session UID, Session UID of the data-block to use by the operator
        - **show_datablock_in_node** (*boolean**,* *(**optional**)*) – Show the data-block selector in the node

bpy.ops.node.add_group_asset(*\**, *asset_library_type='LOCAL'*, *asset_library_identifier=''*, *relative_asset_identifier=''*)
:   Add a node group asset to the active node tree

    Parameters:
    :   - **asset_library_type** (enum in [Asset Library Type Items](bpy_types_enum_items/asset_library_type_items.html#rna-enum-asset-library-type-items), (optional)) – Asset Library Type
        - **asset_library_identifier** (*string**,* *(**optional**,* *never None**)*) – Asset Library Identifier
        - **relative_asset_identifier** (*string**,* *(**optional**,* *never None**)*) – Relative Asset Identifier

bpy.ops.node.add_group_input_node(*\**, *socket_identifier=''*, *panel_identifier=0*)
:   Add a Group Input node with selected sockets to the current node editor

    Parameters:
    :   - **socket_identifier** (*string**,* *(**optional**,* *never None**)*) – Socket Identifier, Socket to include in the added group input/output node
        - **panel_identifier** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Panel Identifier, Panel from which to add sockets to the added group input/output node

bpy.ops.node.add_image(*\**, *filepath=''*, *directory=''*, *files=None*, *hide_props_region=True*, *check_existing=False*, *filter_blender=False*, *filter_backup=False*, *filter_image=True*, *filter_movie=True*, *filter_python=False*, *filter_font=False*, *filter_sound=False*, *filter_text=False*, *filter_archive=False*, *filter_btx=False*, *filter_alembic=False*, *filter_usd=False*, *filter_obj=False*, *filter_volume=False*, *filter_folder=True*, *filter_blenlib=False*, *filemode=9*, *relative_path=True*, *show_multiview=False*, *use_multiview=False*, *display_type='DEFAULT'*, *sort_method=''*, *name=''*, *session_uid=0*)
:   Add a image/movie file as node to the current node editor

    Parameters:
    :   - **filepath** (*string**,* *(**optional**,* *never None**)*) – File Path, Path to file
        - **directory** (*string**,* *(**optional**,* *never None**)*) – Directory, Directory of the file
        - **files** (`bpy_prop_collection` of `OperatorFileListElement`, (optional)) – Files
        - **hide_props_region** (*boolean**,* *(**optional**)*) – Hide Operator Properties, Collapse the region displaying the operator settings
        - **check_existing** (*boolean**,* *(**optional**)*) – Check Existing, Check and warn on overwriting existing files
        - **filter_blender** (*boolean**,* *(**optional**)*) – Filter .blend files
        - **filter_backup** (*boolean**,* *(**optional**)*) – Filter .blend files
        - **filter_image** (*boolean**,* *(**optional**)*) – Filter image files
        - **filter_movie** (*boolean**,* *(**optional**)*) – Filter movie files
        - **filter_python** (*boolean**,* *(**optional**)*) – Filter Python files
        - **filter_font** (*boolean**,* *(**optional**)*) – Filter font files
        - **filter_sound** (*boolean**,* *(**optional**)*) – Filter sound files
        - **filter_text** (*boolean**,* *(**optional**)*) – Filter text files
        - **filter_archive** (*boolean**,* *(**optional**)*) – Filter archive files
        - **filter_btx** (*boolean**,* *(**optional**)*) – Filter btx files
        - **filter_alembic** (*boolean**,* *(**optional**)*) – Filter Alembic files
        - **filter_usd** (*boolean**,* *(**optional**)*) – Filter USD files
        - **filter_obj** (*boolean**,* *(**optional**)*) – Filter OBJ files
        - **filter_volume** (*boolean**,* *(**optional**)*) – Filter OpenVDB volume files
        - **filter_folder** (*boolean**,* *(**optional**)*) – Filter folders
        - **filter_blenlib** (*boolean**,* *(**optional**)*) – Filter Blender IDs
        - **filemode** (*int in* *[**1**,* *9**]**,* *(**optional**)*) – File Browser Mode, The setting for the file browser mode to load a .blend file, a library or a special file
        - **relative_path** (*boolean**,* *(**optional**)*) – Relative Path, Select the file relative to the blend file
        - **show_multiview** (*boolean**,* *(**optional**)*) – Enable Multi-View
        - **use_multiview** (*boolean**,* *(**optional**)*) – Use Multi-View
        - **display_type** (enum in [`'DEFAULT'`, `'LIST_VERTICAL'`, `'LIST_HORIZONTAL'`, `'THUMBNAIL'`], (optional)) –

          Display Type

          - `DEFAULT`
            Default – Automatically determine display type for files.
          - `LIST_VERTICAL`
            Short List – Display files as short list.
          - `LIST_HORIZONTAL`
            Long List – Display files as a detailed list.
          - `THUMBNAIL`
            Thumbnails – Display files as thumbnails.
        - **sort_method** (enum in [`'DEFAULT'`, `'FILE_SORT_ALPHA'`, `'FILE_SORT_EXTENSION'`, `'FILE_SORT_TIME'`, `'FILE_SORT_SIZE'`, `'ASSET_CATALOG'`], (optional)) –

          File sorting mode

          - `DEFAULT`
            Default – Automatically determine sort method for files.
          - `FILE_SORT_ALPHA`
            Name – Sort the file list alphabetically.
          - `FILE_SORT_EXTENSION`
            Extension – Sort the file list by extension/type.
          - `FILE_SORT_TIME`
            Modified Date – Sort files by modification time.
          - `FILE_SORT_SIZE`
            Size – Sort files by size.
          - `ASSET_CATALOG`
            Asset Catalog – Sort the asset list so that assets in the same catalog are kept together. Within a single catalog, assets are ordered by name. The catalogs are in order of the flattened catalog hierarchy..
        - **name** (*string**,* *(**optional**,* *never None**)*) – Name, Name of the data-block to use by the operator
        - **session_uid** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Session UID, Session UID of the data-block to use by the operator

bpy.ops.node.add_import_node(*\**, *directory=''*, *files=None*)
:   Add an import node to the node tree

    Parameters:
    :   - **directory** (*string**,* *(**optional**,* *never None**)*) – Directory, Directory of the file
        - **files** (`bpy_prop_collection` of `OperatorFileListElement`, (optional)) – Files

bpy.ops.node.add_mask(*\**, *name=''*, *session_uid=0*)
:   Add a mask node to the current node editor

    Parameters:
    :   - **name** (*string**,* *(**optional**,* *never None**)*) – Name, Name of the data-block to use by the operator
        - **session_uid** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Session UID, Session UID of the data-block to use by the operator

bpy.ops.node.add_material(*\**, *name=''*, *session_uid=0*)
:   Add a material node to the current node editor

    Parameters:
    :   - **name** (*string**,* *(**optional**,* *never None**)*) – Name, Name of the data-block to use by the operator
        - **session_uid** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Session UID, Session UID of the data-block to use by the operator

bpy.ops.node.add_node(*\**, *settings=None*, *use_transform=False*, *type=''*, *visible_output=''*)
:   Add a node to the active tree

    Parameters:
    :   - **settings** (`bpy_prop_collection` of `NodeSetting`, (optional)) – Settings, Settings to be applied on the newly created node
        - **use_transform** (*boolean**,* *(**optional**)*) – Use Transform, Start transform operator after inserting the node
        - **type** (*string**,* *(**optional**,* *never None**)*) – Node Type, Node type
        - **visible_output** (*string**,* *(**optional**,* *never None**)*) – Output Name, If provided, all outputs that are named differently will be hidden

    File:
    :   [startup/bl_operators/node.py:419](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/node.py#L419)

bpy.ops.node.add_object(*\**, *name=''*, *session_uid=0*)
:   Add an object info node to the current node editor

    Parameters:
    :   - **name** (*string**,* *(**optional**,* *never None**)*) – Name, Name of the data-block to use by the operator
        - **session_uid** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Session UID, Session UID of the data-block to use by the operator

bpy.ops.node.add_repeat_zone(*\**, *settings=None*, *use_transform=False*, *offset=(150.0, 0.0)*)
:   Add a repeat zone that allows executing nodes a dynamic number of times

    Parameters:
    :   - **settings** (`bpy_prop_collection` of `NodeSetting`, (optional)) – Settings, Settings to be applied on the newly created node
        - **use_transform** (*boolean**,* *(**optional**)*) – Use Transform, Start transform operator after inserting the node
        - **offset** (*float array* *of* *2 items in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Offset, Offset of nodes from the cursor when added

    File:
    :   [startup/bl_operators/node.py:633](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/node.py#L633)

bpy.ops.node.add_reroute(*\**, *path=None*, *cursor=11*)
:   Add a reroute node

    Parameters:
    :   - **path** (`bpy_prop_collection` of `OperatorMousePath`, (optional)) – Path
        - **cursor** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Cursor

bpy.ops.node.add_simulation_zone(*\**, *settings=None*, *use_transform=False*, *offset=(150.0, 0.0)*)
:   Add simulation zone input and output nodes to the active tree

    Parameters:
    :   - **settings** (`bpy_prop_collection` of `NodeSetting`, (optional)) – Settings, Settings to be applied on the newly created node
        - **use_transform** (*boolean**,* *(**optional**)*) – Use Transform, Start transform operator after inserting the node
        - **offset** (*float array* *of* *2 items in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Offset, Offset of nodes from the cursor when added

    File:
    :   [startup/bl_operators/node.py:633](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/node.py#L633)

bpy.ops.node.add_zone(*\**, *settings=None*, *use_transform=False*, *offset=(150.0, 0.0)*, *input_node_type=''*, *output_node_type=''*, *add_default_geometry_link=False*)
:   Undocumented, consider [contributing](https://developer.blender.org/).

    Parameters:
    :   - **settings** (`bpy_prop_collection` of `NodeSetting`, (optional)) – Settings, Settings to be applied on the newly created node
        - **use_transform** (*boolean**,* *(**optional**)*) – Use Transform, Start transform operator after inserting the node
        - **offset** (*float array* *of* *2 items in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Offset, Offset of nodes from the cursor when added
        - **input_node_type** (*string**,* *(**optional**,* *never None**)*) – Input Node, Specifies the input node used by the created zone
        - **output_node_type** (*string**,* *(**optional**,* *never None**)*) – Output Node, Specifies the output node used by the created zone
        - **add_default_geometry_link** (*boolean**,* *(**optional**)*) – Add Geometry Link, When enabled, create a link between geometry sockets in this zone

    File:
    :   [startup/bl_operators/node.py:633](https://projects.blender.org/blender/blender/src/branch/main/scripts/startup/bl_operators/node.py#L633)

bpy.ops.node.attach()
:   Attach active node to a frame

bpy.ops.node.backimage_fit()
:   Fit the background image to the view

bpy.ops.node.backimage_move()
:   Move node backdrop

bpy.ops.node.backimage_sample()
:   Use mouse to sample background image

bpy.ops.node.backimage_zoom(*\**, *factor=1.2*)
:   Zoom in/out the background image

    Parameters:
    :   **factor** (*float in* *[**0**,* *10**]**,* *(**optional**)*) – Factor

bpy.ops.node.bake_node_item_add(*\**, *node_identifier=0*)
:   Add item below active item

    Parameters:
    :   **node_identifier** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Node Identifier, Optional identifier of the node to operate on

bpy.ops.node.bake_node_item_move(*\**, *direction='UP'*, *node_identifier=0*)
:   Move active item

    Parameters:
    :   - **direction** (enum in [`'UP'`, `'DOWN'`], (optional)) – Direction, Move direction
        - **node_identifier** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Node Identifier, Optional identifier of the node to operate on

bpy.ops.node.bake_node_item_remove(*\**, *node_identifier=0*)
:   Remove active item

    Parameters:
    :   **node_identifier** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Node Identifier, Optional identifier of the node to operate on

bpy.ops.node.capture_attribute_item_add(*\**, *node_identifier=0*)
:   Add item below active item

    Parameters:
    :   **node_identifier** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Node Identifier, Optional identifier of the node to operate on

bpy.ops.node.capture_attribute_item_move(*\**, *direction='UP'*, *node_identifier=0*)
:   Move active item

    Parameters:
    :   - **direction** (enum in [`'UP'`, `'DOWN'`], (optional)) – Direction, Move direction
        - **node_identifier** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Node Identifier, Optional identifier of the node to operate on

bpy.ops.node.capture_attribute_item_remove(*\**, *node_identifier=0*)
:   Remove active item

    Parameters:
    :   **node_identifier** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Node Identifier, Optional identifier of the node to operate on

bpy.ops.node.clear_viewer_border()
:   Clear the boundaries for viewer operations

bpy.ops.node.clipboard_copy()
:   Copy the selected nodes to the internal clipboard

bpy.ops.node.clipboard_paste(*\**, *offset=(0.0, 0.0)*)
:   Paste nodes from the internal clipboard to the active node tree

    Parameters:
    :   **offset** (*float array* *of* *2 items in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Location, The 2D view location for the center of the new nodes, or unchanged if not set

bpy.ops.node.closure_input_item_add(*\**, *node_identifier=0*)
:   Add item below active item

    Parameters:
    :   **node_identifier** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Node Identifier, Optional identifier of the node to operate on

bpy.ops.node.closure_input_item_move(*\**, *direction='UP'*, *node_identifier=0*)
:   Move active item

    Parameters:
    :   - **direction** (enum in [`'UP'`, `'DOWN'`], (optional)) – Direction, Move direction
        - **node_identifier** (*int in* *[**0**,* *inf**]**,* *(**optional*