It is probably because the QTwain class requires an event loop to be running, and until you call app.exec(), there is no event loop.
Your code is fundamentally different from the example in the previous post in the thread. You need to move your twain code into a method that gets called after the event loop has started.
Bookmarks