Answer the question
In order to leave comments, you need to log in
How to implement multithreading in the program?
When compiling a multi-threaded program on Windows, I ran into a problem that if __name__ == '__main__': does not work and when threads start, they start restarting themselves, how to fix it?
It seems that I read that there is such a problem with Windows, but I don’t remember where.
The problem is the current in the running program, if you run it from the command line, then everything works as it should.
Answer the question
In order to leave comments, you need to log in
If the file with if __name__ == "__main__":
is started from some other file, then the if will not work.
Accordingly, if you need to use the file in a program with multithreading, you need to remove this if .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question