This question is related to Pyside 4

I am trying to accomplish something that at first seemed like a common task but maybe I am overlooking some technical problem with it.

I have a simple class for "database". The init has a few lines of code for connecting to the database, and then the class has various functions for standard read and write operations and a few special cases etc. In the past, I would initialize the database class, and then just use its functions to accomplish basic IO. The issue is that the database connection in the init, as well as the IO methods, can take a second or two, leaving the main GUI frozen. In the past I have used the qthread class for this, and placed code in the run() method for either a one-shot running of the code, or a periodic (once a minute or something) running of some code. In this case, though, I want the thread to just run as long as the instance of the class is running. Or to be more specific, the thread should run for initialization of the database class as well as whenever I call a method of the database class. I have searched for this and found suprisingly few results for something that seems like it would be a common desire. (to have one instance run as a thread)

Thanks.