Commands syntax error

I just try to Kit Command.
In GUI, I drag the usd file to viewport to reference.
And in commands, I got that commands.
It is

import omni.kit.commands
from omni import usd._usd
from pxr import Sdf

omni.kit.commands.execute(‘CreatePayloadCommand’,
usd_context=<omni.usd._usd.UsdContext object at 0x7fbf7d3a6070>,
path_to=Sdf.Path(‘/World/ant’),
asset_path=‘omniverse://localhost/NVIDIA/Assets/Isaac/2022.2.1/Isaac/Robots/Ant/ant.usd’,
instanceable=False)

When I tried it in script editor.
I got error
SyntaxError:(‘Invalid syntax’, …, 'from omni import usd_usd’n))
So I changed it

from omni import usd._usd => import omni.usd

But I got another error

SyntaxError:(‘invalid syntax’, …, usd_context=<omni.usd._usd.UsdContext object at 0x7fbf7d3a6070>

What is the problem?

Other commands works good.

I fixed it
usd_context=<omni.usd._usd.UsdContext object at 0x7fbf7d3a6070> => usd_context = omni.usd.get_context()

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.