What platform? I tested a - made up - complete program on Windows 11 and that works.
But it is better - and more complex - to use a thread and synchronize.
If ShowMessage did not show up on Windows, there are other errors in your code...
I can test on Linux and Apple later. (Linux + Qt6 works OK)
[edit]On some widgetsets the showmessage can be hidden behind the main form!! Move the main form...then click the title bar of the showmessage...On some platforms ShowMessage is not modal and stayontop.