'Perform a blocking task in the background by running the passed
method in a thread.'

def waiting_dialog(self, task, msg):

    def target():
        try:
            task()
        except Exception as err:
            self.show_error(str(err))
        Clock.schedule_once((lambda dt: app.info_bubble.hide(now=True)), (-1))
    app.show_info_bubble(text=msg, icon='atlas://gui/kivy/theming/light/important', pos=Window.center, width='200sp', arrow_pos=None, modal=True)
    t = threading.Thread(target=target)
    t.start()
