♻ Loop (All Lines from input)
Loop (All Lines from input) (Bjornulf_custom_nodes) — ComfyUI Node Guide
- STRING
This is one of the simplest, most-used nodes in Bjornulf's whole pack: give it a block of text, it splits on newlines, and everything downstream runs once per line. No manual re-queuing, no writing your prompts into ten separate nodes - you paste a list, hit run once, and ComfyUI grinds through every line automatically.
People actually build real pipelines on top of this. One workflow that surfaced from pack users: split a whole document into individual lines (by punctuation, sentence by sentence), feed each line through this node into a text-to-speech node, and end up with a full audiobook-style narration generated from a single queue click - no manual line-by-line clicking required. That's the kind of use case this node is built for: anywhere you have a batch of discrete text units and want each one to trigger a full generation pass.
How it works
The mechanism is ComfyUI's native list-execution behavior. This node takes your input text, splits it into individual lines, and outputs that as a list rather than a single string. When a node's output is a list, ComfyUI re-executes every downstream node once per item in that list automatically - that's the "loop" in the name. You're not writing a loop in the traditional programming sense; you're handing ComfyUI a list and letting its own execution engine do the repeating.
Inputs and outputs
One required input: text, a plain STRING - whatever multiline block you want split. One output: a STRING list (marked is_list: true in the node's schema), which is what triggers the downstream repetition. Wire it into anything that accepts text - a prompt encode, a Write Text node, a TTS node - and that whole branch of your graph runs once per line.
Installing it
Comes bundled with the rest of Bjornulf_custom_nodes. ComfyUI Manager → search "Bjornulf_custom_nodes" → install → restart, or manually: cd ComfyUI/custom_nodes && git clone https://github.com/justUmen/Bjornulf_custom_nodes, then restart ComfyUI. No dependency specific to this node beyond the pack's base install - it's pure string splitting.
Common issues & troubleshooting
The most common surprise for people new to this pattern: a run that looks "stuck" is often just working through a long list, one full generation at a time. If you fed it fifty lines, you queued fifty complete passes through your workflow, and ComfyUI's progress bar reflects the current item, not the whole batch - check your queue count, not just the spinner.
If you're doing anything with audio or image quality where you might want to redo a single bad line without re-running the entire batch, this isn't the right node for that job - it always runs the full list start to finish. Bjornulf's own advice, and it's good advice: reach for the Loop Sequential (input Lines) node instead when you want to step through one line at a time by hand, check the result, and optionally regenerate just that one before moving to the next. This node is for "run everything, once"; the sequential version is for "run one at a time, on purpose, with control."
Also worth knowing: empty lines in your input text still count as list items, so a paragraph with stray blank lines between sentences will queue extra empty-text runs. Clean up your input text first if you're seeing more executions than lines you actually wrote.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |