don't use single-underscore names
if available, use the thread-safer invoke_in_main_thread (not required when setting the global variables)
set __lock to True outside of the thread, otherwise if the thread starts late, the while loop is skipped
call get_character_object in the main thread
(cherry picked from commit 7a25a13926cd40e7f657f6336062aa48255b4b64)