Set scene/file as dirty through python

I have a simple addon that alow me to precisely tilt points of a curve through properties.
However using them won’t mark the scene as dirty and the user won’t be prompted with the “save before close” popup.

Clicking a button just to mark the scene as dirty isn’t the best user experience

I tried multiple ways to circumvent that. Calling operators, adding/moving objects, changing scene propertys, timers to keep track of the changes, etc. Apparently nothing done through python can set the scene as dirty.

Am I missing something? Thanks.

A timer seems to work:

import bpy

def delayed_check():
    print(f"in a timer callback: {}")
print(f"before object creation: {}")
o ="temp", None)
print(f"after object creation: {}")

before object creation: False
after object creation: False
in a timer callback: True