from threading import Thread def queue_worker(i, q): while True: url = q.get() # Get an item from the queue, blocks until one is available print('to process:', url) q.task_done() # Notifies the queue that the item has been processed q = queue.Queue() Thread(target=queue_worker, args=(0, q), daemon=True).start() q.put('https://scrapeme.live/shop/page/1/') q.join() # Blocks until all items in the queue are processed and marked as done print('Done') # to process: https://scrapeme.live/shop/page/1/ # Done