# how to set a delay in blender execution

Is it possible, in Blender, to insert by script an object, wait 1 second, and put a second object? I used the time.sleep(1) (after that the first object has been imported into the scene) but it doesn't work because it put both the objects after 2 seconds. What's the problem??

import time if x == 3: bpy.ops.wm.append(directory= ...., filename= .....) time.sleep(1) elif x == 2: bpy.ops.wm.append(directory= ..., filename= .....)

• It's probably actually doing what you want, but it won't update the UI until the script has finished executing. You want to use a modal operator. Mar 15, 2017 at 12:43
• .. in particular a Modal Timer Operator Mar 15, 2017 at 12:48

Probably bad idea, but might just work for simple fiddling:

import bpy
import functools

# Add 10 cubes in 10 seconds
def add_cubes(x = 0):
x += 1
if(x < 10): # Run add_cubes(x) after 1 second