Index Error: BMElemSeq[index] I'm new to this and I don't know how to fix it, but what I'm doing is converting the script to 2.80. Eventually, I'm in the process where I make it compatible with blender 2.82, and now I'm facing this error when I try to import.
for v in range (len (verts)): bm.verts.new (verts[v])
    for c in range (faceNum):
        id = bm.verts
        ids = id[ind[c][0]], id[ind[c][1]], id[ind[c][2]] #error in this line
        bm.faces.new (ids)
    bm.to_mesh (me.data)
    n = 0
    datnum = me.data.uv_layers[0].data

I search everything on google and I can't find a solution to this problem. Thank you


sorry I made a screenshot of it but forgot to put it here.
# When your add/remove vert(s) in your mesh. You need add
bm.verts.ensure_lookup_table()
# to your code

# When your add/remove egde(s) in your mesh. You need add
bm.edges.ensure_lookup_table()
# to your code

# When your add/remove face(s) in your mesh. You need add
bm.faces.ensure_lookup_table()
# to your code