Change the export stl file code from Exported from Blender-x.x.x to object name I want export model into stl format in ASCII, which Blender can do. However when I open the exported stl file by text, the first line is always like this:

solid Exported from Blender-2.91.2

And the last line is:

endsolid Exported from Blender-2.91.2

I want to change the string &quot;Exported from Blender-2.91.2&quot; to my stl file name, so I have to open my stl files again and again to change the name. This bothers me a lot and I don't know how to fixed it once and for all. I tried to open the addon folder io_mesh_stl(path:2.91\scripts\addons) and find in file stl_utils,line 75:

return &quot;Exported from Blender-&quot; + bpy.app.version_string

Is it because this line? How can I fix my problem? Thanks a lot if anyone can help!
Slippery Slope.
Would investigate doing this in a post pro way, Using something like sed   or python, to run thru stl files and automate the bothersome edit, rather than updating the addon code.
That said, a quick edit to change the header when writing to ASCII
stl_utils.py
def _ascii_write(filepath, faces):
    from mathutils.geometry import normal

    with open(filepath, 'w') as data:
        fw = data.write
        header = _header_version()
        fw('solid %s\n' % header)

        for face in faces:
            # calculate face normal
            fw('facet normal %f %f %f\nouter loop\n' % normal(*face)[:])
            for vert in face:
                fw('vertex %f %f %f\n' % vert[:])
            fw('endloop\nendfacet\n')

        fw('endsolid %s\n' % header)

change the code (circa line 205) from
header = _header_version()

to
header = filepath

or to hack it just to use the filepath stem &quot;/path/foo/bar/stem.extension&quot;
from pathlib import Path
header = Path(filepath).stem

or to hack it just to use the filname (with extension) &quot;/path/foo/bar/filename&quot;
from pathlib import Path
header = Path(filepath).name