# Codeless schema example and its use from python

**URL:** <https://forum.aousd.org/t/codeless-schema-example-and-its-use-from-python/1245>\
**Category:** USD\
**Created:** [February 20, 2024, 7:18pm UTC](https://forum.aousd.org/t/codeless-schema-example-and-its-use-from-python/1245 "2024-02-20T19:18:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggarra13](https://avatars.discourse-cdn.com/v4/letter/g/d78d45/32.png) [@ggarra13](https://forum.aousd.org/u/ggarra13)\
**Post date:** [February 20, 2024, 7:18pm UTC](https://forum.aousd.org/t/codeless-schema-example-and-its-use-from-python/1245/1 "2024-02-20T19:18:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mati-nvidia](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/mati-nvidia/32/18_2.png) [@mati-nvidia](https://forum.aousd.org/u/mati-nvidia)\
**Post date:** [February 21, 2024, 11:58am UTC](https://forum.aousd.org/t/codeless-schema-example-and-its-use-from-python/1245/2 "2024-02-21T11:58:03Z")

</div>

Here’s an example of a codeless schema: [usd-plugin-samples/src/usd-plugins/schema/omniExampleCodelessSchema at main · NVIDIA-Omniverse/usd-plugin-samples · GitHub](https://github.com/NVIDIA-Omniverse/usd-plugin-samples/tree/main/src/usd-plugins/schema/omniExampleCodelessSchema) .

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()`.

---

<div class="post-metadata">

**Author:** ![spiff](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/spiff/32/22_2.png) [@spiff](https://forum.aousd.org/u/spiff)\
**Post date:** [March 3, 2024, 10:56pm UTC](https://forum.aousd.org/t/codeless-schema-example-and-its-use-from-python/1245/3 "2024-03-03T22:56:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![aothms](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@aothms](https://forum.aousd.org/u/aothms)\
**Post date:** [August 5, 2024, 3:48am UTC](https://forum.aousd.org/t/codeless-schema-example-and-its-use-from-python/1245/4 "2024-08-05T03:48:07Z")

</div>

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:

```auto
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:

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

```
