Set dupli_group to particle system

Hi everybody !

I’m currently working on a fire spread simulator in a city.
So I generate a city using particle system. After that I need to convert this system to object and then I would be able to work on each building to make fire spread.

Before convert my particle system I need to set a dupli_group to it. Here is where I get an issue.
I don’t find how to put my group “Group.001” to my particle system.

I show you a part of my code :



 # Particle system
    bpy.ops.object.particle_system_add()
    psys = emitter.particle_systems[-1]
    psys.name = 'building'
 
    pset = psys.settings
    pset.type = 'HAIR'
    pset.name = 'buildingSettings'
    pset.use_advanced_hair = True    
    pset.emit_from = 'VERT'
    pset.count = numberOfBuildings
    pset.use_rotation_dupli = True
    pset.use_emit_random = False
    pset.use_rotations = True
    pset.rotation_mode = 'OB_Y'
    pset.render_type = 'GROUP'    
    pset.use_group_pick_random = True
    
    # Set dupli_group
    pset.dupli_group = WHAT TO PUT HERE ? -> the name of the group is Group.001
	
    # Convert particle system to real objects
    bpy.ops.object.duplicates_make_real(use_base_parent=False, use_hierarchy=False)
   
    # Remove particle system
    #bpy.ops.object.particle_system_remove()


Big thanks to any one who read my post !

triguN.

pset.dupli_type = ‘GROUP’
pset.dupli_group = bpy.data.groups[‘Group.001’]

you can get the 1st group of current object like: bpy.context.object.users_group[0]

Big thanks to you CoDEmanX !! That’s work !