[Book Tools] Loop Start
Where a Book Tools loop decides what to feed in
- first_loop
- loop
- *
BTLoopStart is the part of the Book Tools loop system that decides what you're looking at: the initial value on the first pass, or the result of the previous pass once the loop is turning. If you've used other ComfyUI loopback nodes you'll recognize the shape immediately - this one is the author's take on the pattern, tuned for feeding "any type" through the cycle.
The triplet it belongs to
A Book Tools loop is three nodes working together:
- BTLoop - the engine. Emits the
LOOPwire and an iteration counter. - BTLoopStart - at the top of the loop body. Passes the first value through on pass one, then the fed-back result on later passes.
- BTLoopEnd - at the bottom. Stashes whatever your loop body produced back onto the loop object.
BTLoopStart has two required inputs: first_loop (type * - anything at all, an image, a conditioning, a seed number) and loop (the LOOP wire from BTLoop). Its single output is also *, so whatever you feed in comes out unchanged in type.
How it decides
The mechanism lives in the source: on each evaluation it checks a module-level reset flag. If the loop was just reset, it returns first_loop - that's your starting value. Otherwise, if the loop object already has a next attribute (set by BTLoopEnd on a previous pass), it returns that. If neither applies, it falls back to first_loop again, which is exactly the right behavior for a loop that hasn't completed a round yet.
So the practical wiring is:
BTLoop (LOOP) ──────────────► BTLoopStart (loop) ──► [loop body]
BTLoopStart (*) ──► [body consumes it]
[body result] ──► BTLoopEnd (send_to_next_loop)
BTLoopEnd (loop) ──► same LOOP wire back
The LOOP wire is a single object threaded through both Start and End - don't create two separate BTLoop nodes, or the feedback loop never connects.
What a beginner actually needs to know
You won't use BTLoopStart in isolation; it's useless without its partners. But if you're building a per-page book renderer, the pattern is: first_loop is your first page's conditioning, the loop body is "generate page, overlay text," and send_to_next_loop at the end carries the previous page's result forward (for continuity between pages, for instance). The iteration counter on BTLoop can drive BTPromptSelector to step through a prompt schedule at the same time.
Installing
ComfyUI Manager (search "ComfyUI-Book-Tools") or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/Big-Idea-Technology/ComfyUI-Book-Tools
# restart ComfyUI
No extra dependencies, no models to fetch. The whole pack is light Python.
A honest caveat
This loop pattern is not a true for-loop; it re-executes the graph while a global counter changes, so each "iteration" is a fresh queue execution. That means anything expensive (model loads) reruns each pass, and two independent loops in one workflow share one global counter - worth knowing before you try nesting them. For a single loop driving page-by-page book rendering, it's perfectly serviceable.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| first_loop | * | — | |
| loop | LOOP | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |