def async_call(func, *args, callback=None):
def do_call():<EOL><INDENT>result = None<EOL>error = None<EOL>try:<EOL><INDENT>result = func(*args)<EOL><DEDENT>except Exception:<EOL><INDENT>error = traceback.format_exc()<EOL>logger.error(error)<EOL><DEDENT>if callback:<EOL><INDENT>GLib.idle_add(callback, result, error)<EOL><DEDENT><DEDENT>thread = threading.Thread(target=do_call)<EOL>thread.daemon = True<EOL>thread.start()<EOL>
Call `func` in background thread, and then call `callback` in Gtk main thread.

    If error occurs in `func`, error will keep the traceback and passed to
    `callback` as second parameter. Always check `error` is not None.