After transferring weights from one object to another vertices might get multiple groups with very low weights. In weight painting view there is a tool 'Clean' that allows to remove all the groups with low weights.
To automate the process I am trying a script like
for obj in bpy.context.visible_objects:
if obj.name[-2:] == '-l':
obj.vertex_group_clean(group_select_mode='ALL', limit=0.005, keep_single=True)
In this snippet I go through visible objects, and if their name ends with "-l" I
want to run vertex_group_clean
method, but the script fails with AttributeError: 'Object' object has no attribute 'vertex_group_clean'
What do I do wrong?