Add created vertices to a list My goal is to add every created vertice to a list.

import bpy
import bmesh
def add_vert(loc):
    bm = bmesh.from_edit_mesh(bpy.context.edit_object.data)
    v = bm.verts.new(loc)
    bm.verts.index_update()
    bm.verts.ensure_lookup_table()
    vertlist = []
    vertlist.extend([v])
    print(vertlist)
    return {v}
add_vert((1,1,1))


This is what I get as output: 
[&lt;BMVert(0x0000020E20C3CF20), index=12&gt;]
[&lt;BMVert(0x0000020E20C3CF58), index=13&gt;]
[&lt;BMVert(0x0000020E20C3CF90), index=14&gt;]

This is what I would like: [&lt;BMVert(0x0000020E20C3CF20), index=12&gt;,&lt;BMVert(0x0000020E20C3CF20), index=13&gt;,&lt;BMVert(0x0000020E20C3CF20), index=14&gt;]
You need to define your vertlist variable outside of the function. Currently, vertlist exists only within the scope of the add_vert function. You can either define it before hand:

vertlist = []
def add_vert(loc):
    ...


or add a try statement to check if vertlist already exists:

def add_vert(loc):
    ...
    try:
        vertlist
    except NameError:
        global vertlist = []
    ...