Houdini RPC port
You can control Houdini remotely by accessing HOM through an RPC (remote procedure call) interface over the network. Houdini provides a built-in RPC module, so you can control a remote copy of Houdini from a Python script.
You might also want to use RPC to communicate between two Python/hython processes running on the same machine, or to communicate between Houdini and Maya, for example.
To start Houdini’s RPC server, type the following in Houdini’s Python shell.
import hrpyc hrpyc.start_server()
The RPC server will run in a separate thread, waiting for RPC calls from
other processes. By default, it listens on port 18811. If you'd like to run
it in the main thread, call hrpyc.start_server(use_thread=False)
.
Now you can remotely control Houdini from another process (or on another computer). For example, in hython or Maya, you could connect to an RPC server on the local machine with:
connection, hou = hrpyc.import_remote_module()
The connection
variable needs to persist for the duration of the RPC
connection. The hou
variable behaves just like the hou
module, and you
use it just like you would if you imported hou into a local session.
Note that the RPC server does not do any authentication by default, so you should ensure that your firewall protects you from unauthorized access to the RPC port.