I'm writing a piece of code where I want to assign the selected grease pencil vertices to a vertex group. So far, with the vertices selected, this is what I have tried:
#create vertex group:
obj.vertex_groups.new(name = 'TEST')
#assign selected vertices to group:
bpy.ops.gpencil.vertex_group_assign()
However, this doesn't work. It creates the vertex group no problem, but doesn't assign anything to it. Any ideas?