Codeless schema example and its use from python

I am investigating the use of a codeless schema to store .otio content inside a .usd file, but sadly, the USD page does not provide any example.
I am looking for an example of the schema.usda and its use in python code.

Here’s an example of a codeless schema: usd-plugin-samples/src/usd-plugins/schema/omniExampleCodelessSchema at main · NVIDIA-Omniverse/usd-plugin-samples · GitHub .

Since a codeless schema doesn’t produce any C++ or Python interface, you need to use the generic USD functions to work with it. For example, Usd.Stage.DefinePrim() and Usd.Prim.CreateAttribute().

Yep, and note that you do still need to run usdGenSchema on your codeless schema.usda so that it produces the generatedSchema.usda and plugInfo.json that the USD runtime uses to populate its SchemaRegistry.

I feel I’m still missing something obvious: How to apply a codeless API schema to a Prim in Python?

I ran codegen to get the plugInfo.json and I have verified my type is present in:

registry.GetAllDerivedTypes(Usd.APISchemaBase)

But these are Tf.Type instances. It seems that the Apply() method used in non-codeless APIschema examples is generated during code generation and not something defined on an abstract base class. Neither in Usd.SchemaRegistry I can find an entry point to apply my codeless API schema.


Edit: indeed turned out to be trivial:

prim = stage.DefinePrim('/root/customPrim', 'Cube')
prim.ApplyAPI(...)