# How to remove variantset in SDF Python?

**URL:** <https://forum.aousd.org/t/how-to-remove-variantset-in-sdf-python/1135>\
**Category:** USD\
**Created:** [January 16, 2024, 8:23am UTC](https://forum.aousd.org/t/how-to-remove-variantset-in-sdf-python/1135 "2024-01-16T08:23:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ziriax](https://avatars.discourse-cdn.com/v4/letter/z/e0b2c6/32.png) [@Ziriax](https://forum.aousd.org/u/Ziriax)\
**Post date:** [January 16, 2024, 8:23am UTC](https://forum.aousd.org/t/how-to-remove-variantset-in-sdf-python/1135/1 "2024-01-16T08:23:38Z")

</div>

In C++, I can call `RemoveVariantSet` on the `SdfPrimSpec`.

But how do I do the same in Python?

The `variantSets` wrapper doesn’t seem to have a `remove` or `pop` method?

---

<div class="post-metadata">

**Author:** ![BigRoyNL](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/bigroynl/32/413_2.png) [@BigRoyNL](https://forum.aousd.org/u/BigRoyNL)\
**Post date:** [January 16, 2024, 9:23am UTC](https://forum.aousd.org/t/how-to-remove-variantset-in-sdf-python/1135/2 "2024-01-16T09:23:44Z")

</div>

You’d need access to the ~~`VariantSetSpec`~~ to remove it. Technically you’d need access to the `PrimSpec.variantSets`.

Basically you’d need to `del` it from the owner’s `variantSets`. Given a spec [here](https://github.com/BigRoy/usd-qtpy/blob/main/usd_qtpy/lib/usd.py#L294-L322) is an example on how to remove it.

I’m pretty sure the [USD Survival Guide might be a helpful read on this topic as well](https://lucascheller.github.io/VFX-UsdSurvivalGuide/core/composition/arcs.html#variants).

So from the `SdfPrimSpec` you’d basically do:

```python
del prim_spec.variantSets[variant_set_name]

```

---

<div class="post-metadata">

**Author:** ![Ziriax](https://avatars.discourse-cdn.com/v4/letter/z/e0b2c6/32.png) [@Ziriax](https://forum.aousd.org/u/Ziriax)\
**Post date:** [January 16, 2024, 5:11pm UTC](https://forum.aousd.org/t/how-to-remove-variantset-in-sdf-python/1135/3 "2024-01-16T17:11:25Z")

</div>

Thanks!

I didn’t find it in the survival guide, but I might have overlooked.

Strange that to remove a variant, you call `RemoveVariant` on the `Sdf.VariantSetSpec`, and `del set_spec.variants[variant_name]` doesn’t work, but to remove a variantset, you call `del prim_spec.variantSets[variant_set_name]`, and `RemoveVariantSet` doesn’t exist?

---

<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:** [January 16, 2024, 10:39pm UTC](https://forum.aousd.org/t/how-to-remove-variantset-in-sdf-python/1135/4 "2024-01-16T22:39:25Z")

</div>

That does indeed seem like an inconsistency, likely going back more than 15 years!
