Answer the question
In order to leave comments, you need to log in
How to run the same script in different threads?
You need to run the same script in different threads, but in each of them you will need to change the data in the variable
class Farm:
def __init__(self):
self.main = durakonline.Client(MAIN_TOKEN, server_id=SERVER_ID, tag="[MAIN]", debug=DEBUG_MODE)
self.bot = durakonline.Client(tag="[BOT]", server_id=SERVER_ID, debug=DEBUG_MODE)
В переменной SERVER_ID должны менятся данные от того какой поток.
Пытался сделать с args не получилось.
Answer the question
In order to leave comments, you need to log in
from threading import Thread
class Farm:
def __init__(self, SERVER_ID, DEBUG_MODE):
self.main = durakonline.Client(MAIN_TOKEN, server_id=SERVER_ID, tag="[MAIN]", debug=DEBUG_MODE)
self.bot = durakonline.Client(tag="[BOT]", server_id=SERVER_ID, debug=DEBUG_MODE)
thread1 = Thread(target= Farm, args = 'значение SERVER_ID', 'значение DEBUG_MODE')
thread2 = Thread(target= Farm, args = 'значение SERVER_ID', 'значение DEBUG_MODE')
thread1.start()
thread2.start()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question