Houdini 20.0 Python scripting


You can control Houdini through HOM scripting from another Python session across the network.

On this page

How to

  1. Houdini does not open an RPC port by default. You must start the RPC server in Houdini before you can connect to it from another computer:

    import hrpyc
    • By default, it listens on port 18811. To set the port number, call hrpyc.start_server(port=portnum).

    • The RPC server will run in a separate thread, waiting for RPC calls from other processes. If you want the server to run in the main thread, call hrpyc.start_server(use_thread=False).

  2. Then, in a Python session in another process or on another computer (for example, in a Maya Python shell), connect to the RPC server:

    connection, hou = hrpyc.import_remote_module()

    connection is an object representing the network connection. If this object is deleted or goes out of scope and is garbage collected, the connection will be closed, so you should keep a reference to it as long as you want the connection to stay open.

    hou is an object that acts like the hou package in Houdini. You use it as if you had imported hou into hython or a Python shell in Houdini:

    node = hou.node("/obj/sphere1")

Please read the notes below for important information.


  • hrpyc is a very thin wrapper around the rpyc library. It is limited to the capabilities provided by the third-party library.

  • The library works by proxying objects and functions. When the remote side calls a function or method, the proxy object sends the request across the network and the Houdini side sends back the result.

    rpyc proxy object do not support Python operators (the library does not proxy special methods such as __eq__). For example, you can’t compare two hou.OpNode proxies on the remote side to see if they are the same node, because the proxies do not support the equality operator:

    # This will fail
    node1 == node2

    Instead you should rework your code so you compare plain Python results of function/method calls instead of the proxied objects themselves:

    # This will work
    node1.path() == node2.path()
  • The RPC server does not do any authentication. If you want to use RPC, you should ensure your IT setup (for example, a firewall) prevents unauthorized access to the server port.

Python scripting

Getting started

Next steps


  • hou

    Module containing all the sub-modules, classes, and functions to access Houdini.

Guru level

Python viewer states

Python viewer handles

Plugin types