Blender stores your recent files in a txt file, [[1]](https://blender.stackexchange.com/a/35251/53513)[[2]](https://blenderartists.org/t/open-recent-file/612357) located in your OS' `.config/blender/version/config/` folder. So once you save it, you just manually prepend the filepath to the beginning of that txt file and reread it in.


```
import bpy
from pathlib import Path

# recent files stored in a text file in your .config folder

recent_files = "C:\\Users\\<Userbane>\\AppData\\Roaming\\Blender Foundation\\Blender\\<your-blender-version>\\config\\recent-files.txt" 

save_path = Path('C:\\Desktop\\my_blend.blend')
bpy.ops.wm.save_mainfile(filepath=save_path)

# add the blendfile path to the recent-files.txt
with open(recent_files, 'r+') as f:
    contents = f.read()
    f.seek(0,0) # go to beginning of file
    if save_path.is_file():
        newfile = save_path.resolve().rstrip('\n\r') + "\n" + contents
        f.write(newfile)
    else:
        print("File did not save correctly.")

# reread file history    
bpy.ops.wm.read_history()