Help:Execute script when changing property?

I’d like to have a script execute everytime you change particle count.
Is it possible? I’ve heard of handlers, but can’t seem to figure it out.

Here’s the script I want to execute for everytime the particle count changes.

if bpy.context.scene.frame_current == 1:
        bpy.context.scene.frame_set(0)
        bpy.context.scene.frame_set(1)

maybe add a custom property? use modal operators?

Will pay if you PM me a functioning script like this. Thanks.

You can attach callbacks to custom properties, but not built-in ones. The only handler that would work here is the scene update handler, but it will call the callback function regardless of changes, and that 20x per second - so not very useful. You can check the particle count in that callback, but it will add some overhead.

@CoDEmanX
Big thanks for the respond.
And since that won’t work, how about running active smoke domain’s current cache to frame through script?