Exec
Run arbitrary Python from inside your ComfyUI graph
- flow
- dependency
- flow
This is the escape hatch: a text box where you type Python, and JNComfy (jn-jairo/jn_comfyui) runs it, right there in the middle of your graph. Every other utility node in this pack - math, logic, string conversion - is really just a pre-packaged version of something you could write yourself here. JN_Exec is what you reach for when none of them cover what you need.
Why you'd want it
Custom node packs generally give you a fixed menu of operations, and eventually you hit something that isn't on the menu - a one-off calculation, a bit of string manipulation with no dedicated node, a quick debug hack. Rather than writing and installing a whole new custom node for a five-line snippet, JN_Exec lets you just paste the Python and go. It's the same spirit as the README's own example of the pack's "easy generic inputs" patch, which shows a tiny custom PrintValue node as a demonstration - except here you don't even need to write a node, you write the code directly into a widget.
How it works
code is a required multiline STRING field - that's the whole interface, whatever you type there runs when the node executes. Like the rest of this pack's workflow-control family, it takes optional flow and dependency inputs so you can pin exactly where in your execution sequence the code runs, since ComfyUI otherwise schedules by data dependency rather than by position on the canvas.
The inputs and outputs that matter
code(STRING, multiline, default empty) - required. Your Python, typed directly into the node.flow(any type, optional) - wire from an upstream flow-chain node to control when this fires relative to other side-effecting nodes.dependency(any type, optional) - an alternate wait-on input, same purpose asflow.
The single output, flow, passes the chain forward to whatever runs next - wire it into the following node's flow/dependency input.
How to install it
Via ComfyUI Manager: search "JNComfy", install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/jn-jairo/jn_comfyui
then restart ComfyUI. This is a small, single-author pack with no real community footprint we could find and no entry in our knowledge base - expect to be reading the source directly if something about the exec environment (what's in scope, what you can import) isn't obvious from experimenting.
Common issues & troubleshooting
This is a code execution node - treat it like one. ComfyUI already runs arbitrary Python via any custom node, so this isn't introducing a new category of risk to the platform, but it does make that risk explicit and interactive: a workflow file someone shares with you can carry a JN_Exec node with anything in it. Read what's inside before you run a downloaded workflow that has one, the same way you'd check any code before executing it.
It runs but doesn't seem to affect anything downstream. This node's only output is flow, not a data value - it's built for side effects (printing, writing a file, mutating something in scope) rather than passing a computed result forward as data. If you need the code's result to actually feed the next node, you'll need to route it out some other way (writing to a value the next node reads, for instance) rather than expecting a data output here.
Execution order looks wrong. Same rule as the rest of this pack's flow family - if flow/dependency aren't wired in and out, ComfyUI has no obligation to run this node at any particular point relative to the rest of the graph.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| code | STRING | — | |
| flowopt | * | — | |
| dependencyopt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| flow | * | — |