Using the Runtime Interface#

So far, we’ve only used paya.runtime to manage patching, reverting pymel.core for calls to PyMEL methods. In fact paya.runtime serves the entire pymel.core namespace, and can be used as a drop-in replacement. Note that context management is still required to return Paya classes:

import paya.runtime as r

cam = r.PyNode('persp')
print(type(cam))
# <class 'pymel.core.nodetypes.Transform'>

with r:
    cam = r.PyNode('persp')
    print(type(cam))
    # <class 'paya.runtime.nodes.Transform'>

Using paya.runtime in this way confers the following advantages:

  • It more clearly signposts patched PyMEL.

  • When patching is active, paya.runtime exposes additional top-level methods and interfaces such as createMatrix().