ComfyUI-Execute-Python
A single ComfyUI node for executing arbitrary Python code with arbitrary inputs of any types
Nodes (1)
ComfyUI-Execute-Python
A single node for executing arbitrary Python code with arbitrary inputs of any types
Preview
<img width="1196" height="797" alt="image" src="https://github.com/user-attachments/assets/aa3216de-8a2f-4170-be5c-36b12c2f5620" />
UPD: syntax highlighting
<img width="1487" height="839" alt="Screenshot_20260407_104048" src="https://github.com/user-attachments/assets/20de1e1b-306c-4ba2-bacf-407efd2e3346" /> <img width="1044" height="629" alt="Screenshot_20260407_104547" src="https://github.com/user-attachments/assets/8e86c8b9-5616-4e0f-a729-cb9e67a4e301" />Installation
Choose one of these options:
- Install via ComfyUI-Manager (search for "Execute Python")
- Use
Custom Nodes Manager > Install via Git URLin ComfyUI-Manager - Clone the repository into
custom_nodes/manually and install dependency fromrequirements.txt(or download .zip from GitHub and unpack it tocustom_nodes/)
Usage
Write your Python code in the widget (it may include imports, functions and any other language features) and assign result variable somewhere in the code. If you use multiple outputs, use a tuple (for example result = 1, 2, 3).
[!IMPORTANT] For safety reasons, this node can't be used from shared workflows, which means that it would only work if you created it yourself.
[!WARNING] The code is executed with a simple
exec, so execute only trusted Python code