I have an object (a feather) with a particle system on it (little objects that turn into spaces later - boolean/difference - to make it look a little ruffled). I have duplicated the object a number of times (to create a wing). Each instance gives me the same particle system output. To randomize the particles on each duplicated object, I give it a new particle setting and change the seed value.

To be able to do this a large number of times (and many other things as well), I am creating code to automate the tasks.

Problem: the particle settings line bpy.ops.particle.new() gives me "#RuntimeError: Operator bpy.ops.particle.new.poll() failed, context is incorrect"

I am new to coding and learning fast. Dove in the documentation and read the Q&A's on this site, but hit a dead end. I am out of my depth here. Help is appreciated.

I know there is a "Button context" called "bpy.context.particle_settings", but I don't know what to do with that.

What context do I need to apply new particle settings to work (and how)? or how can I override the context?

In the snipped below one edge of the feather, containing the particle system, is selected and made active, before attempting to add new settings

object = bpy.data.objects[edge_name]
object.select = True
bpy.context.scene.objects.active = bpy.data.objects[edge_name]
bpy.ops.particle.new() #RuntimeError: Operator bpy.ops.particle.new.poll() failed, context is incorrect 
bpy.context.object.particle_systems["ParticleSystem"].seed = seed_value

2 Answers 2


The bpy.ops.particle.new() is not the operator name you are after.

bpy.context.scene.objects.active = bpy.data.objects[edge_name]
bpy.context.object.particle_systems.active.seed = seed_value

It is usually preferred to not use operators in scripts. For creating particle systems the method may appear a bit odd as adding a modifier seems to be the only non-operator way to do it. You might notice that this way doesn't need to alter the active or selected objects.

object = bpy.data.objects[edge_name]

if len(object.particle_systems) == 0:
    object.particle_systems.active.seed = seed_value

Once you have the particle system on the object you can either change each setting to suit or you can set it to use an existing particle setup.

object.particle_systems[0].settings = bpy.data.particles['MyGreatParticles']

While a new particle setting will be created each time you add a particle modifier and you will get more of them as you repeat this, by using an existing particle setup they will have zero user count and will not be saved to disk.

  • $\begingroup$ Thank you sambler. Clear answer. However, this gives me a new, different, particle system next to the already existing one. The goal is to keep all settings of the existing particle system and only change the seed value for each of the duplicates. That requires different particle settings for each duplicate.</br>Here the .blend file</br>Here is the code $\endgroup$
    – Aloys
    Dec 28, 2014 at 12:59
  • $\begingroup$ The if len(object.particle_systems) == 0: tests for an existing particle system, only adding one if there is no existing particles for the object. $\endgroup$
    – sambler
    Dec 28, 2014 at 13:23
  • $\begingroup$ I understand. If there is no particle system yet, it it adds a whole new particle system with standard settings; not the settings I want (and already have). So, I do understand that this method gives me a particle system without messing with context. It just does not give the settings that I want. Should I then add all the settings I want via python as well (other than just the seed value)? It would be nice if I could just copy the settings with a new name and alter only the seed value. $\endgroup$
    – Aloys
    Dec 28, 2014 at 13:48
  • $\begingroup$ I expanded to show using existing settings. $\endgroup$
    – sambler
    Dec 30, 2014 at 7:19
  • $\begingroup$ Sambler, thanks! I get it and know what to do, except that I get an error on the code for using an existing particle setup: <br/>TypeError: bpy_prop_collection[key] = value: invalid, expected a 'ParticleSystem' type or None, not a 'ParticleSettings' $\endgroup$
    – Aloys
    Dec 30, 2014 at 21:41

Came accross an answer to the question by lyzard.3d on blenderartists.org that works as well (source)

cube = bpy.data.objects['Cube'] #get object
par_set = bpy.data.particles['ParticleSettings'] #get particle setting you want to assign
cube.particle_systems['ParticleSystem'].settings = par_set #assign particle settings to object's particle system

It does require to create all particle setting names before running the script, otherwise it comes up empty handed.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .