Create a Reference¶
The CreateReference
command is a convenient wrapper that creates an Xform prim and adds a Reference to it all at once. If you don’t need the two steps batched together, you may want to Add a Reference to an existing prim via Kit Commands or USD API.
Omniverse Kit Commands¶
import omni.kit.commands
import omni.usd
from pxr import Sdf
omni.kit.commands.execute("CreateReference",
path_to=Sdf.Path("/World/New/Prim/Path"), # Prim path for where to create the reference
asset_path=r"C:/path/to/file.usd", # The file path to reference. Relative paths are accepted too.
usd_context=omni.usd.get_context()
)