Wrong Variable Assignment

Hello,
So this code snippet should make obj a single user of the particle settings and then set “new_start” as the new start frame and “new_start + temp_run” as the new end frame of the particle system.

        obj.particle_systems[0].settings = obj.particle_systems[0].settings.copy()
        obj.particle_systems[0].settings.frame_start = new_start
        obj.particle_systems[0].settings.frame_end = new_start + temp_run

“new_start” = 39 in this example

The Previous Settings were:
Start: 10
End: 15
and the New Settings are:
Start: 15
End: 44

However Start should be 39 and after some testing i found out that the new start value is always the old end value.
I added some prints to see where it goes wrong but no luck.

        print(new_start)
        print(obj.particle_systems[0].settings.frame_start)
                
        obj.particle_systems[0].settings = obj.particle_systems[0].settings.copy()
        print(obj.particle_systems[0].settings.frame_start)
        
        obj.particle_systems[0].settings.frame_start = new_start
        print(obj.particle_systems[0].settings.frame_start)

        obj.particle_systems[0].settings.frame_end = new_start + temp_run

The code prints following:

39
10
10
15

I have no idea why the end setting works but the start does not…and why the start setting is the old end setting.
I am not a very advanced programmer so maybe there is a simple solution(I actually hope so).
I hope someone can help me.
-Cubezz

Probably because you can’t set frame_start to 39 when frame_end is 15, that doesn’t make sense, so you’re probably not allowed to change it that way. You would need to update frame_end first to 45 and then change frame_start to 39 so there’s “room” for the new changes.

Haha now everything makes sense. Thank you so much!