Comfy-Org / Comfy-Org/ComfyUI_frontend

Exporting Subgraphs as custom nodes

Open
#6,409 12 comments 5 reactions 0 assignees View on GitHub
area:subgraph enhancement Feature
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

### Feature Idea

Subgraph is a great encapsulation tool, but it lacks GLOBALITY.
They are nice:
* helps to hide all the wires
* refuse variables nodes
* allows to edit workflow comfortly in logical parts of it

But they are just GROUPS that got collapsed in nodes and encapsulated parameters and outputs.

For now they work like:
```py
inputs = [1, 2, 3]
print(str(1) + ": " + inputs[0])
print(str(2) + ": " + inputs[1])
print(str(3) + ": " + inputs[2])
```
But it would be nice to work like this:
```py
inputs = [1, 2, 3]
def f(idx, value):
print(str(idx) + ": " + value)
f(1, inputs[0])
f(2, inputs[1])
f(3, inputs[2])
```

I.E. What i want is literally making FUNCTIONS for workflows, that can be edited in one place and will be applied all over the workflow (Or all over the workflows). I see this as local "composite nodes" and as composite workflows that can be exported from other workflows and used in other places.

It solves:
* When I duplicate a subgraph, it becomes a separate entity.
Video: https://github.com/user-attachments/assets/9fba5e8d-cb8f-4b37-89e8-4865d226a2e1
* Any changes must be applied manually to each copy.

### Existing Solutions

_No response_

### Other

_No response_

---

*This issue is transferred from: https://github.com/comfyanonymous/ComfyUI/issues/9340*

Original issue was created by @AlexMorgan3817 at 2025-08-14T19:39:21.000Z

**Original Comments:**

@comfyui-wiki:

I think this feature is already part of our development plan.

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-6409-Exporting-Subgraphs-as-custom-nodes-29c6d73d365081f4be0dd1911b80e8bf) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.