Nodes/FlowNodes/🐍 Stack python exec parameters
ComfyUI Node

🐍 Stack python exec parameters

Hand named variables to your script

By gitmyloΒ·Created 2 years agoΒ·Updated about a year agoΒ· 13
🐍 Stack python exec parameters
  • input0
  • input1
  • input2
  • input3
  • input4
  • input5
  • input6
  • input7
  • input8
  • input9
  • input10
  • input11
  • input12
  • input13
  • input14
  • input15
  • input16
  • input17
  • input18
  • input19
  • Flow
  • Stacked params
  • Flow

The 🐍 Execute Python node is powerful but has a boring limitation: it takes exactly one input, and inside the script that input is called input0. Want your script to see five different values under five different names? That's what "🐍 Stack python exec parameters" is for - it collects up to twenty inputs (input0 through input19) into one object, and when you feed that object into Execute Python's Input socket, every stacked value becomes a named variable in your script.

How the magic works

The node does something that looks trivial: it returns a dict of whatever inputs are connected - {input0: ..., input1: ...} - with a FLOW output for ordering. The type on the output socket is EXEC_PARAMS, which is FlowNodes' way of saying "this is a bundle meant for the script node."

The real behavior lives on the Execute Python side. Its code does:

if isinstance(kwargs["Input"], dict):
    loc = loc | (kwargs["Input"])

Meaning: if the Input arriving at Execute Python is a dict, its keys become local variables in the script. Feed it the stacked dict and input0 (plus whatever else you connected) are just... there, usable by name. If you connect something that isn't a dict, it lands as plain input0 instead - the fallback single-input behavior.

What you'd use it for

Any script that needs more than one piece of data:

  • A prompt and a seed: connect both, and the script sees input0 and input1 ready to use.
  • A prompt, a width, a height, a filename - all wired, all named, no parsing.
  • Pre-computed values from the rest of the graph (an Int Expression result, a Regex match count) bundled into one clean script input.

Since both nodes carry Flow sockets, you can also sequence them: stack parameters β†’ flow β†’ execute β†’ flow, so the script runs exactly when the bundle is ready.

The limitations

  • You still get input0, input1, … as names. The stacked keys are positional (input0, input1, ...), not the semantic names you might wish for. If you want named variables like width/height, the dict keys would need those names - this node doesn't rename for you. That's what the persistent dict or building a dict in Execute Python is for.
  • The node has no required inputs. Connect as few or as many as you need; unconnected slots are simply absent from the bundle.
  • It's a bundle, not a script. The stacked dict is only meaningful to Execute Python's Input socket (and anything else that understands EXEC_PARAMS/dict inputs). Feeding it elsewhere gets you a Python dict, which you can also process with the Generic operation nodes.

Install

Part of the FlowNodes pack:

cd ComfyUI/custom_nodes
git clone https://github.com/gitmylo/FlowNodes
# restart ComfyUI

or ComfyUI Manager β†’ search FlowNodes β†’ install. No Python dependencies, no models.

Troubleshooting

  • Script says input1 is not defined - that input wasn't connected, so it's not in the bundle. Wire it.
  • Connected a value but the script still sees only input0 - if you fed Execute Python a plain value (not the Stack node's output), it goes to the single-input path. Make sure the bundle output is what's connected.
  • Order in the script seems off - the variable names are positional (input0, input1). If you meant semantic names, rename the wiring, not the bundle.
CategoryπŸ”‚ FlowNodes/function

Inputs (21)

NameTypeDefaultDescription
input0opt*β€”
input1opt*β€”
input2opt*β€”
input3opt*β€”
input4opt*β€”
input5opt*β€”
input6opt*β€”
input7opt*β€”
input8opt*β€”
input9opt*β€”
input10opt*β€”
input11opt*β€”
input12opt*β€”
input13opt*β€”
input14opt*β€”
input15opt*β€”
input16opt*β€”
input17opt*β€”
input18opt*β€”
input19opt*β€”
FlowoptFLOWβ€”

Outputs (2)

NameTypeDescription
Stacked paramsEXEC_PARAMSβ€”
FlowFLOWβ€”