user: How do I use NodeTreeInterface(bpy_struct) in Blender? Include parameters, examples, warnings and best practices.

assistant: # NodeTreeInterface(bpy_struct)

base class — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct")

*class* bpy.types.NodeTreeInterface(*bpy_struct*)
:   Declaration of sockets and ui panels of a node group

    active
    :   Active item

        Type:
        :   [`NodeTreeInterfaceItem`](bpy.types.NodeTreeInterfaceItem.html#bpy.types.NodeTreeInterfaceItem "bpy.types.NodeTreeInterfaceItem")

    active_index
    :   Index of the active item

        Type:
        :   int in [0, inf], default 0

    items_tree
    :   Items in the node interface

        Type:
        :   [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`NodeTreeInterfaceItem`](bpy.types.NodeTreeInterfaceItem.html#bpy.types.NodeTreeInterfaceItem "bpy.types.NodeTreeInterfaceItem"), (readonly)

    new_socket(*name*, *\**, *description=''*, *in_out='INPUT'*, *socket_type='DEFAULT'*, *parent=None*)
    :   Add a new socket to the interface

        Parameters:
        :   - **name** (*string**,* *(**never None**)*) – Name, Name of the socket
            - **description** (*string**,* *(**optional**,* *never None**)*) – Description, Description of the socket
            - **in_out** (enum in [`'INPUT'`, `'OUTPUT'`], (optional)) –

              Input/Output Type, Create an input or output socket

              - `INPUT`
                Input – Generate a input node socket.
              - `OUTPUT`
                Output – Generate a output node socket.
            - **socket_type** (enum in [`'DEFAULT'`], (optional)) – Socket Type, Type of socket generated on nodes
            - **parent** ([`NodeTreeInterfacePanel`](bpy.types.NodeTreeInterfacePanel.html#bpy.types.NodeTreeInterfacePanel "bpy.types.NodeTreeInterfacePanel"), (optional)) – Parent, Panel to add the socket in

        Returns:
        :   Socket, New socket

        Return type:
        :   [`NodeTreeInterfaceSocket`](bpy.types.NodeTreeInterfaceSocket.html#bpy.types.NodeTreeInterfaceSocket "bpy.types.NodeTreeInterfaceSocket")

    new_panel(*name*, *\**, *description=''*, *default_closed=False*)
    :   Add a new panel to the interface

        Parameters:
        :   - **name** (*string**,* *(**never None**)*) – Name, Name of the new panel
            - **description** (*string**,* *(**optional**,* *never None**)*) – Description, Description of the panel
            - **default_closed** (*boolean**,* *(**optional**)*) – Default Closed, Panel is closed by default on new nodes

        Returns:
        :   Panel, New panel

        Return type:
        :   [`NodeTreeInterfacePanel`](bpy.types.NodeTreeInterfacePanel.html#bpy.types.NodeTreeInterfacePanel "bpy.types.NodeTreeInterfacePanel")

    copy(*item*)
    :   Add a copy of an item to the interface

        Parameters:
        :   **item** ([`NodeTreeInterfaceItem`](bpy.types.NodeTreeInterfaceItem.html#bpy.types.NodeTreeInterfaceItem "bpy.types.NodeTreeInterfaceItem"), (never None)) – Item, Item to copy

        Returns:
        :   Item Copy, Copy of the item

        Return type:
        :   [`NodeTreeInterfaceItem`](bpy.types.NodeTreeInterfaceItem.html#bpy.types.NodeTreeInterfaceItem "bpy.types.NodeTreeInterfaceItem")

    remove(*item*, *\**, *move_content_to_parent=True*)
    :   Remove an item from the interface

        Parameters:
        :   - **item** ([`NodeTreeInterfaceItem`](bpy.types.NodeTreeInterfaceItem.html#bpy.types.NodeTreeInterfaceItem "bpy.types.NodeTreeInterfaceItem"), (never None)) – Item, The item to remove
            - **move_content_to_parent** (*boolean**,* *(**optional**)*) – Move Content, If the item is a panel, move the contents to the parent instead of deleting it

    clear()
    :   Remove all items from the interface

    move(*item*, *to_position*)
    :   Move an item to another position

        Parameters:
        :   - **item** ([`NodeTreeInterfaceItem`](bpy.types.NodeTreeInterfaceItem.html#bpy.types.NodeTreeInterfaceItem "bpy.types.NodeTreeInterfaceItem"), (never None)) – Item, The item to move
            - **to_position** (*int in* *[**0**,* *inf**]*) – To Position, Target position for the item in its current panel

    move_to_parent(*item*, *parent*, *to_position*)
    :   Move an item to a new panel and/or position.

        Parameters:
        :   - **item** ([`NodeTreeInterfaceItem`](bpy.types.NodeTreeInterfaceItem.html#bpy.types.NodeTreeInterfaceItem "bpy.types.NodeTreeInterfaceItem"), (never None)) – Item, The item to move
            - **parent** ([`NodeTreeInterfacePanel`](bpy.types.NodeTreeInterfacePanel.html#bpy.types.NodeTreeInterfacePanel "bpy.types.NodeTreeInterfacePanel")) – Parent, New parent of the item
            - **to_position** (*int in* *[**0**,* *inf**]*) – To Position, Target position for the item in the new parent panel

    *classmethod* bl_rna_get_subclass(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The RNA type or default when not found.

        Return type:
        :   [`bpy.types.Struct`](bpy.types.Struct.html#bpy.types.Struct "bpy.types.Struct") subclass

    *classmethod* bl_rna_get_subclass_py(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The class or default when not found.

        Return type:
        :   type