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= .....)

  • 1
    $\begingroup$ 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. $\endgroup$
    – JakeD
    Mar 15, 2017 at 12:43
  • $\begingroup$ .. in particular a Modal Timer Operator $\endgroup$
    – batFINGER
    Mar 15, 2017 at 12:48

1 Answer 1


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
        bpy.app.timers.register(functools.partial(add_cubes,x), first_interval=1) 




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.