How to define a globe variable in py?

I add two threading in a py file and the variable in one could be read
or
write in the other threading.
So how and where I should add the define of the variable even the also
need
be used in py main loop?

you should declare the variable out of the threads and use something
similar
to a lock. because you’re using threads, if you don’t use locks, a
operation
of read/write could lead to mistaken results.

Fernando R.

That means out of any class?
Or could show me a example, thanks

2009/9/11 Fernando R. [email protected]

That means out of any class?

yes

Or could show me a example, thanks

Local and global variables - Python example - first
result
of ‘global variables python’. i think that this is what you need :slight_smile:

Fernando R.