How to programmatically reparent a prim/set a prim path?

How would one change an existing prim’s path in a python extension? I’m looking for the programmatic equivalent of dragging and dropping or renaming the prim in the outliner.

2 Likes

Hi @alistair.wick,

Using “MovePrim” in omni.kit.commands.execute, I was able to perform the desired operation.

import omni.kit

path = “/World/Sphere”
pathTo = “/World/xxx/Sphere”

#Change Prim’s path.
#path_from : Path of the original Prim.
#path_to : Path to move to.
omni.kit.commands.execute(“MovePrim”, path_from=path, path_to=pathTo)

2 Likes