How to wait for take_high_res_screenshot?

I have a script that takes a screenshot using

screenshotTask = unreal.AutomationLibrary.take_high_res_screenshot(SCREEN_X, SCREEN_Y, screenshotPath)

How do I wait for screenshotTask.is_task_done() to become true?

Think the file should be accessible the very next line, the limitation I found is mostly that you can only make one capture this frame. We implemented something like a ‘coroutine’ in our python bridge a function that would allow us to in python yield result per frame,

for x in range(10):
  # capture screen, and edit settings for next frame, 
  yield WaitForNextFrame

I noticed that on_tick waits for texture streaming causing hiccups and skips a few screenshots, but pre_tick does the work here is updated version

import unreal

class capture(object):
  def __init__(self):
    self.actors = (actor for actor in unreal.EditorLevelLibrary.get_selected_level_actors())
    self.on_pre_tick = unreal.register_slate_pre_tick_callback(self.__pretick__)

  def __pretick__(self, deltatime):
      actor = next(self.preactors)
      shot_name = actor.get_name()
      unreal.AutomationLibrary.take_high_res_screenshot(1920,1080, shot_name + ".png")
    except Exception as error: