open
is a command, that runs the application as a separate task. If you wanted to wait for the completion, you'd have to directly run the executable inside the app (.app is just a suffix for directories).
But as you don't want to do that: The app itself handles all the loading, MacOS is (probably, I have actually no idea whatsoever about how operating systems work) just copying all the bits and bytes from that executable file into RAM; and then the scheduler from the operating system runs it.
Some applications open a window directly, but not all do. The calls to do that are running through some libraries sometimes, and it generally takes a while. So trying to measure the time it takes to open a window doesn't work either (and applications may initialize other things as well; and measuring time for such tasks isn't a great way to deal with such problems anyway).
The solution is the following: You want to resume if a window by that program is opened, right? If you know the name of the process, it is pretty easy:
import os
import subprocess
devnull = open(os.devnull, 'w')
script = """
tell application "System Events"
set frontApp to first application process whose name is "{}" and frontmost is true
end tell
"""
...
while subprocess.check_call(["osascript", "-e", script.format("name_of_the_process")], stdout=devnull, stderr=devnull) != 0:
pass
osascript
runs AppleScript "applications", in this case an application that tries to get the process with the name you provided that has to have a window that is on top. This is the name of the directory without the trailing ".app", I'd guess. This doesn't work if this app isn't opened, leaving us with a non-zero exit code (-1719 in this case), while it doesn't have any problems if the app is opened. The variable is set, and the script exits, leaving us with a 0 as an exit code.
If you only want to wait for the process to appear, remove the and frontmost is true
from the AppleScript code in the script
variable.
My code works as expected on my Mac, but it does print to stdout.