Remove class (GSClass) from features

I am using a script to automatically generate some classes. It looks something like this which is working fine:

font.classes.append(GSClass('class-name', string))

I am wondering, is there a way to remove a class in the features via a script? Any time I run the script, it duplicates the class. I would like to replace the class if it already exists.

I tried: font.classes.remove(GSClass('class-name', string)) but it doesn’t work reliably for me.

Any thoughts?


del Font.classes["class-name"]

Ah yes! That seems to be working. Thank you!