You already have a reference to the correct class: cls
:
valid_kwargs = get_valid_kwargs(cls.__init__, config_dict)
The class method is bound to the class object it is being called on. For MyDerivedClass.from_yaml()
, cls
is not bound to parent class but to MyDerivedClass
itself.