Alternative to using sleep() to avoid a race condition in PyQt
Use a Queue, python has a threadsafe Queue class.

Push the function you want to run on the background thread onto the queue.

Have the thread wait on the queue executing functions as they are put into it.