How to detect and remove "orphaned" drivers

Hi again :slight_smile:

One thing I’ve noticed about copying and pasting drivers in Blender is that the entries in the graph editor are just not synched with the either the operations done manually through the GUI or when passed through a script. Like, if you delete a shape key that has a driver on it, the driver can still be seen in the graph editor, giving out an error that it is not being owned by anything.

Is there a way to detect “orphaned” drivers and delete them through Python?

Thanx and cheers;


I think I would just have a function that clears the key_block of its drivers before I delete it, to be on the safe side. But that’s just my opinion.

Yes this function with a loop

but the Orphan Cleanup add-on don’t be easily modified to make this function.