No verts are assigned to the group
The trivial error in question code (
boy) aside, you have not assigned any vertices to the new group.
Test script, assigns verts indices 0, 1 and 4 to the new vertex group of object named "Cube" if it exists.
obj = bpy.data.objects.get("Cube")
vg = obj.vertex_groups.new(name='Group')
# need to assign some verts to group
vg.add([0, 1, 4], 1.0, 'REPLACE')
for v in obj.data.vertices:
for g in v.groups:
if g.group == vg.index:
If you already have a vg named "Group" and wish to use it, or create if non existent
vg = (obj.vertex_groups.get('Group')
Feel it is important to note that question code
vertexgroup = obj.vertex_group.get('Group')
will work "as expected" only when there is no prior vg named "Group". Other wise the newly added group will be named "Group.001", "Group.002" etc etc, yet you are only ever getting the one originally named "Group".