Nodes/ComfyUI Functional/Function Parameter
ComfyUI Node

Function Parameter

How you declare a function's arguments

By Duanyll·Created 11 months ago·Updated 4 months ago· 2
Function Parameter
    • *
    index0

    Function Parameter is how you declare an argument in ComfyUI Functional. It's the def half of the pack's function system: you drop one of these per argument your function takes, wire it into the subgraph that forms the function body, and let Call Function supply the values when it's time to run. The node itself does nothing clever - it's a placeholder that stands in for "a value that will be provided later."

    The input that matters

    • index - an INT, default 0, range 0–1000. This is the parameter's position in the call order.
    • output - *, a stand-in value that's only real once the function is called.

    The index is the whole story. When you call the function, arguments line up by these indices: param_0 in the caller maps to the Function Parameter with index = 0, param_1 maps to index = 1, and so on. The docs' advice is good: rename each Function Parameter node so its purpose is obvious (e.g. mask, strength), because you'll be matching them against caller inputs by order, not by name.

    How it works

    At definition time, this node is just a marker. When you queue the workflow, the pack's transform hook walks the graph and tags every node that depends (transitively) on a Function Parameter as part of the function body. If a parameter-dependent value tries to reach an output node without passing through a Function End or Inspect, the node refuses to run and emits a long, specific error about output nodes incorrectly depending on Function Parameter. That error is the pack's guard against undefined behavior - a parameter that escapes the function body has no real value yet, and ComfyUI can't run it.

    The honest gotchas

    • Indexes are positional, and they're easy to get wrong. Two Function Parameters both at index 0 will silently collide. Rename them and check the indexes before you wire a multi-arg call.
    • Parameter order, not name, is what matters. The caller's param_0 fills whatever parameter sits at index 0. Keep the mapping in your head (or in node titles).
    • Every parameter must terminate. If a Function Parameter feeds something that reaches an output node without going through Function End or Inspect, you get the escape error. Route it through the End, or use Inspect if you just want to peek at a temporary value mid-function.

    This is also the node behind the pack's famous "Prompt has no outputs" frustration: you defined parameters, built a body, and forgot to actually call the function or connect its result. The parameters are real; the call is what makes them mean something.

    Installing it

    Part of Duanyll/comfyui_functional. ComfyUI Manager: search "Duanyll/comfyui_functional", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Duanyll/comfyui_functional
    # restart ComfyUI
    

    No models, no pip deps. It's only meaningful alongside Function End and Call Function - start with the pack's functional-nested-calls.json example workflow, which shows parameters and nesting in a working graph before you build your own.

    Categoryduanyll/functional

    Inputs (1)

    NameTypeDefaultDescription
    indexINT00–1000

    Outputs (1)

    NameTypeDescription
    **