Exception Access Violation when trying to add face to new Facemap
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