[Blender2.8]When getting vertex belongs to vertex group
No verts are assigned to the group
The trivial error in question code (bpy not 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 &quot;Cube&quot; if it exists.
import bpy

obj = bpy.data.objects.get(&quot;Cube&quot;)

if obj:
    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:
                 print(v.index)

If you already have a vg named &quot;Group&quot; and wish to use it, or create if non existent
vg = (obj.vertex_groups.get('Group')
     or obj.vertex_groups.new(name='Group'))

Feel it is important to note that question code
obj.vertex_groups.new(name='Group')
vertexgroup = obj.vertex_group.get('Group')

will work &quot;as expected&quot; only when there is no prior vg named &quot;Group&quot;.  Other wise the newly added group will be named &quot;Group.001&quot;, &quot;Group.002&quot; etc etc, yet you are only ever getting the one originally named &quot;Group&quot;.