Nodes/ComfyUI-Qais-Helper/QH: Item Switch
ComfyUI Node

QH: Item Switch

An A/B switch that routes anything, images included

By QaisMalkawi·Created 3 years ago·Updated 6 months ago· 2
QH: Item Switch
  • Input1
  • Input2
  • output
Use_First

"QH: Item Switch" is a two-way selector: plug anything into Input1 and Input2, flip the Use_First boolean, and it passes through whichever one you picked. The trick that makes it useful - and occasionally annoying - is that both inputs are wildcard types. It doesn't care what you're switching. Images, latents, conditioning, models, numbers, strings, all fine. If the two things you want to toggle between are the same kind of thing, this node can switch them.

The obvious use is A/B testing in a workflow: two versions of a prompt, two LoRA stacks, two different source images - one boolean decides which one flows on, and you don't rebuild the graph to try the other. It's also the natural endpoint for conditional logic. Your boolean ops (like the pack's own Bool Binary Operation) produce a condition; this node turns that condition into an actual routing decision.

How it works

  • Input1 - wildcard, anything.
  • Input2 - wildcard, anything.
  • Use_First - BOOLEAN. True routes Input1 to the output, false routes Input2.
  • output - the wildcard output, carrying whichever input won.

The implementation is a two-line if statement, and it validates inputs with a blanket "yes, always" so ComfyUI won't complain at connection time. That permissiveness is the feature and the footgun at once.

Where people get burned

The wildcard output is the main pain point. When a node says "outputs *," ComfyUI's frontend can be picky about what it'll accept downstream - you may find that an input port refuses the connection even though it's conceptually fine, or that the node doesn't play well with tools that check types strictly. This is the classic any-type-node problem, and the community has genuinely mixed feelings about it: these nodes make routing effortless and workflows messier to read and debug at the same time. If you use it, label your wires and keep the switch count low.

Second gotcha: because validation is always-true, it won't stop you from switching between mismatched types. If Input1 is an image and Input2 is a string, it'll happily pass the string when you flip the boolean, and the failure surfaces downstream in whatever node receives it. The node trusts you. Verify your two inputs are actually the same kind of thing.

Installing it

Standard QaisHelper install - numpy-only, no models, nothing heavy:

  • ComfyUI Manager - search "ComfyUI-QaisHelper" and Install.
  • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/QaisMalkawi/ComfyUI-QaisHelper, then restart.

It lives under "Qais Helper" as "QH: Item Switch."

The honest take

For a pack this small, the switch is one of the more genuinely reusable nodes - an untyped two-way selector is a hole ComfyUI's core leaves open. It's not the only one (other packs ship similar "anything switch" nodes), but it works, it's free, and it's hard to break in normal use. The type-flexibility is both why you'd reach for it and why you should be careful with it. Switch same-typed things, keep it tidy, and it'll quietly do its job for years.

CategoryQais Helper

Inputs (3)

NameTypeDefaultDescription
Input1*
Input2*
Use_FirstBOOLEAN

Outputs (1)

NameTypeDescription
output*