I have been struggling with the same issue.
Using time.sleep() on the main thread freezes the editor and doesn’t work well with the rendering process.
I found a post where someone recommended using Qt’s singleShot.
It works well but I would’ve much preferred a callback/delegate implementation.