# Unlinking particle system datablocks from python

I have a problem which has been solved on this site before, right here:

Except for the fact that I am setting up my whole scene from python, and having to manually go to every object with a particle effect, click on the users icon, and set the start and end frames by hand, is becoming very tedious, when everything else in the scene has been accomplished by script.

My situation: I have a helicopter from which I am shooting rockets. I am creating the scene by reading an xml file output from another application. I start with a blend file that has one helicopter and one rocket, and then make a duplicate of the helicopter and as many duplicates of the rocket as are called for in the xml file.

The problem: I have a particle system attached to my sample rocket. I need to set the start and end frames of each rocket's particle system according to the time it was fired and the time it hit something and exploded. When I make a duplicate of the rocket, it makes a linked copy of the same particle system, so when I set the start and end frames, all the rockets end up with the same start and end frame.

I have tried every permutation of make_single_user that I can think of, but actually it doesn't even do what I want when I call it through the interface, so I'm not sure if it affects particle systems. In any event it does nothing for me in python.

Anybody know how to do this?

Copy the particle system settings

Here is a simple test script on what I believe you want to achieve. Select object with at least one particle system. Copies the context object, copies the settings of particle system 0, changes the start frame on copy to 22 and sets this to particle system 0 on copy.

import bpy

context = bpy.context
scene = context.scene
ob = context.object
# copy object
obcopy = ob.copy()
# copy particle settings
ps = ob.particle_systems[0].settings.copy()
ps.frame_start = 22
# new settings on copy
obcopy.particle_systems[0].settings = ps

Expanding on @batFINGER answer. If the second object (obcopy) does not have a modifier, then you would need to create a modifier before duplicating the particle settings from the original object (ob):
# Duplicate particle settings