def __init__(self): super(UploaderBot, self).__init__() self.bot = telegramHigh(BOT_TOKEN) self.h_subscribers = SubscribersHandler( path.join(SCRIPT_FOLDER, "dropbox_photo_uploader_subscribers.save"), INITIAL_SUBSCRIBER_PARAMS) self.dbx = dropbox.Dropbox(DB_TOKEN) self.thread_keep_alive_flag = True # a flag. When false, the sender thread terminates self.uploader_queue = Queue() # contains all parameters to be queued to thread that haven't been processed yet. self.queue_saver = ListThreadedSaver( filename=path.join(SCRIPT_FOLDER, QUEUE_PARAMS_STORAGE_FILENAME)) # reload queue for param in self.queue_saver.list_generator(): self.uploader_queue.put(param) # starts the main loop self.bot.start(processingFunction=self.processUpdate, periodicFunction=self.periodicFunction, termination_function=self.termination_function)