InvokeAI/invokeai/app/invocations/custom_nodes
psychedelicious d4be945dde fix(nodes): gracefully handle custom nodes init error
Previously, exceptions raised as custom nodes are initialized were fatal errors, causing the app to exit.

With this change, any error on import is caught and the error message printed. App continues to start up without the node.

For example, a custom node that isn't updated for v4.0.0 may raise an error on import if it is attempting to import things that no longer exist.
2024-04-02 13:25:14 +11:00
..
init.py fix(nodes): gracefully handle custom nodes init error 2024-04-02 13:25:14 +11:00
README.md feat(nodes): change expected structure for custom nodes 2023-10-20 14:28:16 +11:00

Custom Nodes / Node Packs

Copy your node packs to this directory.

When nodes are added or changed, you must restart the app to see the changes.

Directory Structure

For a node pack to be loaded, it must be placed in a directory alongside this file. Here's an example structure:

.
├── __init__.py # Invoke-managed custom node loader

├── cool_node
   ├── __init__.py # see example below
   └── cool_node.py

└── my_node_pack
    ├── __init__.py # see example below
    ├── tasty_node.py
    ├── bodacious_node.py
    ├── utils.py
    └── extra_nodes
        └── fancy_node.py

Node Pack __init__.py

Each node pack must have an __init__.py file that imports its nodes.

The structure of each node or node pack is otherwise not important.

Here are examples, based on the example directory structure.

cool_node/__init__.py

from .cool_node import CoolInvocation

my_node_pack/__init__.py

from .tasty_node import TastyInvocation
from .bodacious_node import BodaciousInvocation
from .extra_nodes.fancy_node import FancyInvocation

Only nodes imported in the __init__.py file are loaded.