@ui.in_background
def button_tapped(sender):
alert_result = console.alert('Title', 'Message', 'Button 1', 'Button 2')
sender.title = 'Button ' + str(alert_result)
This is in the documentation for the ui module. Not sure if this is what you are looking for, but it will run the function on a background thread instead of the regular interpreter thread.