Thread running without ending which results in asyncio.run(V2_Plus().init()) not running the class

Viewed 13

so I have a python script called main.py which on start imports a class from a file in the same directory called sub.py. in sub.py it runs a thread that checks for debugging tools it starts it with this code

threading.Thread(target=self.blockDebuggers).start()
        for t in [self.listCheck, self.inVirtualenv, self.onCheck, self.specsCheck, self.dllCheck, self.procCheck]:
            x = threading.Thread(target=t)
            self.processes.append(x)
        for thread in self.processes:
            thread.start()
        for process in self.processes:
            process.join()

once that script is finished with what its doing it allows main.py to run at the end of main.py I have asyncio.run(V2_Plus().init()) which it seems to hang at. Hovering over asyncio.run in Visual Studio mentions how it cannot be run when theres a loop running in the same thread. I don't need the script in sub.py to keep running. Is there a way to stop the previous thread to allow asyncio.run to work in main.py?

This had me stuck for a long time as all the code before asyncio.run(V2_Plus().init()) runs but once it hits that point it just freezes. I know its a loop happening in sub.py as replacing the code in sub.py to just a simple print('testing') spits out the word testing over and over in console.

0 Answers
Related