Altering particle rotations / locations via python So I am trying to manipulate the generation of the particle system to something which is predefined. However, when I set the particles location or rotation it is not reflected in the 3D viewport.

My setup is just a simple plane and trying to manipulate the particle system via this code:

bpy.context.active_object.particle_systems['ParticleSystem'].particles[0].location = [5,5,5]


I have tried bpy.context.scene.update() and bpy.context.active_object.particle_systems[0].particles.update() but neither seem to do anything. The python api is responding out correctly, it just isnt reflecting in the viewport. Is there anything else i need to do?
Got this to work by using the somewhat deprecated and dangerous method for forcing a scene redraw bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1).



import bpy
import numpy as np
from mathutils import Vector

p = bpy.context.active_object.particle_systems['ParticleSystem'].particles

locations = 10 * np.random.random((len(p),3)) - 5
locations = [ Vector(co) for co in locations ]

for pp, loc in zip( p, locations ):
    pp.location = loc

bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1) # &lt;== This is the magic operator