Experts,
I have a need to load a usd file belonging to a plant model into the viewport, via a custom extension/app. If I use the below command in the script editor and run, the usd file gets loaded without any issue
omni.kit.commands.execute(“CreatePayload”,
usd_context=omni.usd.get_context(),
path_to=Sdf.Path(“/World/bugatti”),
asset_path=“D:/test/bugatti.usd”,
instanceable=False
)
However if I try to achieve the same thing by putting the above code in a custom extension (added this on on_startup()), nothing happens when I run my app for the first time. But, when I go back and do some change and save my extension, I see my usd getting loaded. I am not sure why it does not load the first time but requires an explicit save action in the extension to trigger the loading of the file.
Attaching the extension.py code. Appreciate if anyone can let me know what am I doing wrong here.
extension.py (1.4 KB)