Nodes/ComfyUI-Custom-Scripts/Load Text 🐍
ComfyUI Node Runs on cloud

Load Text 🐍

Pull a saved text file into your workflow

By pythongosssssΒ·Created 3 years agoΒ·Updated 6 months agoΒ· 3,150
Load Text 🐍
    • STRING
    β—„root_dirβ–Ύβ–Ί
    β—„fileβ–Ύβ–Ί

    Load Text is the read half of a pair - Save Text writes a string out to disk, this one reads one back in as a STRING you can wire into a prompt, a String Function node, or a Show Text for a quick sanity check. If you've ever wanted to re-load a prompt or caption you saved earlier without retyping it, this is that node.

    Part of ComfyUI-Custom-Scripts, pythongosssss's utility pack. Simple, but it closes a loop the pack itself opens with Save Text - one node writes, this one reads, and together they give you a lightweight way to persist text across sessions without a database or an external file manager.

    The inputs that matter

    root_dir picks which of ComfyUI's three managed folders to read from: input, output, or temp - the same three Save Text writes into. file is a dropdown, not a free-text field, populated from whatever's actually sitting in that folder; if nothing's there, it just shows [none].

    That dropdown-not-freetext choice is a small but real guardrail - you can't typo a path into pointing at nothing, but it also means the file has to already exist in one of ComfyUI's managed folders before this node can see it. You're picking from what ComfyUI already knows about, not browsing an arbitrary location on your filesystem.

    Output

    A single STRING - the full contents of whichever file you picked, not a list. Wire it wherever a text input goes.

    Real uses

    Re-loading a prompt or caption log a previous Save Text call wrote, so you can regenerate from the exact same string later without hunting through your history. Reading a per-image caption .txt that already sits alongside a training dataset - handy if you're feeding captions into a workflow rather than a trainer. Loading a saved "preset" prompt without keeping a dozen separate CLIPTextEncode nodes cluttering your graph just to hold text you reuse often. It also pairs naturally with String Function downstream: load a base prompt, then append or regex-swap pieces of it on the fly instead of maintaining several near-duplicate text files.

    Installing it

    • ComfyUI Manager - search "ComfyUI-Custom-Scripts", install, restart.
    • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/pythongosssss/ComfyUI-Custom-Scripts, restart.

    No models, no extra dependencies.

    Common issues

    File dropdown shows [none]. Either the wrong root_dir is selected - input, output, and temp are genuinely separate folders, and it's easy to check the wrong one - or the folder is simply empty.

    Just saved a file with Save Text and it's not showing up here yet. The dropdown populates when the workflow loads, not live - refresh the browser or reload the workflow to pick up a file that was written after the graph was already open.

    Getting the wrong content. Double-check root_dir before assuming the file itself is bad. It's easy to end up with two similarly-named files sitting in input and output respectively and pick the wrong one from the dropdown.

    Categoryutils

    Inputs (2)

    NameTypeDefaultDescription
    root_dirCOMBO3 options: input, output, temp
    fileCOMBO1 options: [none]

    Outputs (1)

    NameTypeDescription
    STRINGSTRINGβ€”