So you are writing some cool Python based tools but you find the need to use HScript. What are you to do? Give up and watch Three’s Company? No, watch Three’s Company after you learn how to run HScript commands from Python.
Run HScript Commands from Python
hou module contains the
hscript function that allows you to execute HScript commands from within Python scripts. You provide the HScript command as a String and the function will return a tuple of 2 strings. The first string contains the regular output of the executed command and the second string contains the error output if any. You can specify multiple commands by using ‘;’ or the newline character as the separator for each command. Command flags are also valid. Just remember the HScript command is a String.