execute
Run Python, HScript, or VEX code in a live Houdini session to access the full hou module, confirm APIs, evaluate expressions, check VEX, and read environment variables.
Instructions
Run code in Houdini, with the full hou module and no guard.
Use it for what no other tool covers, and to confirm an API in the live
session, for example `print(dir(hou.Node))`. The code runs with the rights
of the Houdini process: it can write files, delete nodes and quit Houdini.
Prefer a named tool when one exists. A write in code to a parameter that
holds an expression, that is disabled or hidden, or whose range clamps the
value changes nothing, and a write to a channel reference changes another
node. The answer lists each such write in `write_warnings`; read it. If you
write the same script twice, the named tool for it is missing: say so in
the feedback at the end of the session.
mode:
"python" — run `source` as Python. Returns stdout and stderr, and
keeps them when the script raises. Print what you want
to see: the value of the last line does not come back.
"hscript" — run `source` as an HScript command.
"expression" — evaluate `source` as an expression. `language` is
"hscript" or "python".
"vex_check" — compile `source` as VEX and report the errors. Nothing
runs.
"env" — read the Houdini variable `name`, for example "HIP".
"job" — the state of the background job `job`: running, with
what it printed so far, or done, with its result.
Use `file` for a script that you run again with other values. Houdini
answers nothing while a script runs: for long work, such as a sweep, use
`background` with a large `timeout`. session action='interrupt' stops it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job | No | job: the job id that background returned. | |
| args | No | file: the values of sys.argv[1:]. | |
| file | No | A Python file to run instead of source, as from a shell: __file__ is its path, __name__ is "__main__", args are in sys.argv[1:]. The text travels once. | |
| mode | No | One of "python", "hscript", "expression", "vex_check", "env", "job". | python |
| name | No | env: the Houdini variable to read, for example "HIP". | |
| source | No | The code: Python, HScript, an expression or VEX, as mode says. | |
| globals | No | Names that exist before the script runs, for example {"radius": 2.0}. | |
| timeout | No | The seconds the script may run. Past it, the script stops where it is, the answer says where, and what it changed stays. | |
| language | No | expression: "hscript" or "python". | hscript |
| background | No | python: return at once with a job id and let the script run. Read it with mode job. Until it ends, other calls are refused. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |