Nodes/ComfyUI-Beyond_nodes/Two Way Switch 🦾
ComfyUI Node

Two Way Switch 🦾

An A/B switch for your graph, with the types taken care of

By beyondprompting·Created 9 months ago·Updated 7 months ago· 0
Two Way Switch 🦾
  • input_1
  • input_2
  • output
selection_setting1

Two Way Switch is the ComfyUI equivalent of flipping a light switch to compare two things instead of one. You've got two prompts, two samplers, two LoRA stacks, two seed settings - whatever - and you want to run both and compare without rewiring the graph every time. This is the node that does it, and because both inputs accept any type, it doesn't care what you're swapping.

How it works

The mechanism is almost insultingly simple, and that's the point. One integer input called selection_setting picks a lane (1 or 2, default 1), and the node returns whichever input matches:

  • selection_setting 2 → returns input_2
  • selection_setting anything else → returns input_1

That's the whole thing. The source has one clever touch though: if the selected input isn't connected (it's None), the node falls back to whichever input is wired. So you can use it as a "disable" switch - leave input_1 unconnected, flip to 2 and back, and the flow keeps working either way. The author's comments even map the values to Disable/Enable semantics, which tells you it was designed to be driven by a settings-style integer node somewhere upstream rather than just clicked.

The any type is the real selling point over a type-specific switch. Images, strings, masks, conditioning, even a whole batch - it passes through untouched with no type coercion and no validation fuss. You can wire the output straight into whatever node needs it.

When you'd actually reach for it

In the wider ecosystem people solve "swap between two things" with rgthree's group muters or bypass nodes, but those flip whole sections of graph and are heavy for a single value. Two Way Switch is the cheap version: wire branch A into input_1, branch B into input_2, run, flip, run again. It's an A/B testing tool for one data flow at a time.

One honest caveat: it's not a lazy switch. Both inputs get evaluated even when unused, so if you're switching between two expensive branches to save VRAM or time, this node saves you nothing - the work already happened upstream. Use it for comparing, not for skipping compute.

Installation

It ships in the Beyond Nodes pack, so install that once:

  • ComfyUI Manager - search "ComfyUI-Beyond_nodes" (or "Beyond Nodes") and hit install.
  • Or manually:
    cd ComfyUI/custom_nodes
    git clone https://github.com/beyondprompting/ComfyUI-Beyond_nodes
    
    Then restart ComfyUI. There's no requirements.txt and nothing to download - this node only needs torch and the ComfyUI core that's already there.

Common issues

  • Wrong branch comes through. The node returns input_1 for any value other than 2. If your workflow suddenly runs the "wrong" side, check the number - leaving it at 1 when you meant 2 is the classic miss.
  • Nothing on the output. If both inputs are unconnected you get None out. Connect at least one.
  • Pack quirk: this is a young pack with almost no community footprint - you'll find no reddit threads to copy a workflow from. When in doubt, test it on a tiny graph first, because there's no crowd-sourced "this is how I wire it" to lean on.

The whole pack is a grab-bag - Compositor nodes, logic nodes, mask helpers - and the README is a pasted-together document from several repos, so don't read it as an inventory. This particular node is one of the most straightforward pieces in it: a switch that switches.

CategoryBeyond nodes/Logic

Inputs (3)

NameTypeDefaultDescription
selection_settingINT11–2
input_1opt*
input_2opt*

Outputs (1)

NameTypeDescription
output*