Extending ComfyUI with Python

By
Shawn @ Prompting Pixels
May 16, 2025
Share this post

ComfyUI’s power can be greatly enhanced when combined with Python. Here’s how to set it up:

  1. Install the ComfyUI tooling nodes custom node.
  2. Enable dev mode in ComfyUI settings.
  3. Set Node ID badge mode to “show all” in Light Graph settings.

Workflow Notes:

The workflow itself doesn’t really matter. All that does is the “Load Image (Base64)” (if performing an image-to-image task) and the “Send Image (WebSocket)” as an output node.

Make sure to notate the Node ID if using the Load Image (Base64) node and also export the workflow as an API file.

Python Integration:

  1. Create a directory with your input image, main.py file, and workflow file.
  2. Main.py will load the workflow, encode the input image to Base64, and send/receive the data to the ComfyUI server.
  3. Be sure to update the server IP address and Load Image node ID in the Python script.

This setup allows for batch processing, automation, and integration with other Python tools, greatly expanding ComfyUI’s capabilities.

Share this tutorial
Shawn @ Prompting Pixels

Join Our Creative Community

Stay updated with the latest tutorials and exclusive content on AI applications and tools.

Thank you! Your submission is confirmed!
Oops! There was an error submitting.