Click here to Skip to main content
15,743,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Ok, before starting to post links from stackoverflow, please first let me explain. I have a script(written in python ofcourse), on which i start a new method(as a new thread) from another script file(.py). Now, what i want is these two scripts(or these two threads) to share one common variable. Is this possible ?

What I have tried:

I tried using queue found here: python - How to share a variable between 2 threads - Stack Overflow[^]
Updated 14-Mar-17 22:22pm
Garth J Lancaster 14-Mar-17 20:46pm    
maybe you'd like to share your code and indicate what the issue is with it (you've said what youve tried but not whats happening/not happening)

- the 'queue' method seems like a good initial approach to me, assuming your thread is possibly producing the (data) and the mainline code is the consumer

Use Improve question to update your question.

1 solution

The answer suggested in the StackOverflow post is exactly what you need.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900