Short answer, you don't do this. Usually when you want to get values from a thread you pass it a queue, and have a your main thread get values from the same queue.
A couple other things: you're calling join(), which will block until the thread is finished making the while loop directly after it unnecessary, and don't use "str" as a variable name since it's already the name of a builtin function.
@sekmani Hi, yes you can directly print my_queue.get(). Also it is a good habit to call my_queue.task_done() after each call to my_queue.get(), although in this simple example, it doesn't change anything. Note that thread1.join() doesn't need to be called before my_queue.get(). You can join the thread at the end of the program, or at any moment when you need to be sure that the thread is finished.