Exception Access Violation when trying to add face to new Facemap Beginner Python scripter here, upon running my operator Blender crashes, inspecting the crashlog just yields an EAV as described. The crash appears to happen at the
&quot;facemaps[x-1].add(face)&quot; line. I haven't been able to find much information about the new facemaps so have only been going off what I found on other similar properties.
I cannot use vertex groups as an alternative as during subdivisions they blend out into other vertices which is not ideal for my purposes.
   def execute(self, context):
        obj = bpy.context.edit_object
        me = obj.data
        bmsh = bmesh.from_edit_mesh(me)
        
        verts = []
        facemaps = []
        face = [0]
        
        x = 1
        
        for f in bmsh.faces:
            for v in f.verts:
                verts.append(v.co)
                
            face[0] = f.index
            facemaps.append(obj.face_maps.new( name = str(x)))
            bpy.ops.object.editmode_toggle()
            facemaps[x-1].add(face)
            bpy.ops.object.editmode_toggle()
            x = x + 1
Perhaps the cause of the crash was accessing an invalid reference.
&gt;&gt;&gt; import bmesh
&gt;&gt;&gt; obj = bpy.context.edit_object
&gt;&gt;&gt; me = obj.data
&gt;&gt;&gt; bmsh = bmesh.from_edit_mesh(me)
&gt;&gt;&gt; bmsh.faces
&lt;BMFaceSeq object at 0x000002686604A600&gt;

&gt;&gt;&gt; bpy.ops.object.editmode_toggle()
{'FINISHED'}

&gt;&gt;&gt; bpy.ops.object.editmode_toggle()
{'FINISHED'}

&gt;&gt;&gt; bmsh.faces
Traceback (most recent call last):
  File &quot;&lt;blender_console&gt;&quot;, line 1, in &lt;module&gt;
ReferenceError: BMesh data of type BMesh has been removed

The following script is based on the examples in API documents.
def execute(self, context):
    obj = bpy.context.edit_object
    me = obj.data
    bmsh = bmesh.from_edit_mesh(me)
    fm_lay = bmsh.faces.layers.face_map.active
    
    for f in bmsh.faces:
            
        fm = obj.face_maps.new( name=str(f.inded+1) )
        f[fm_lay] = fm.index