Skip to main content

Spawn a thread that executes tasks in order

Project description

Threaded Task Executor

Allows functions to be called in a seperate thread and executed in FIFO order.

Possible Uses:

  • For serial communication where send/recv order matters
  • Run background tasks in tkinter easily, without freezing gui
  • Any application where background tasks are required to be executed in order

Gettings Started:


pip install threaded-task-executor


from threaded_task_executor import Task_Queue, Task

How To Use

tasks = Task_Queue()
tasks.add_task(Task(print, args=("test 1")))
tasks.add_task(Task(print, args=("test 2")))

When this is run it should start the thread and execute the tasks in FIFO order.


Task(func, callback=None, task_name="", args=(), kwargs={})
  • func : the function that will be called when executed
  • callback : function that will be run when the task has started and finished
    • callback("STARTED", task_name)
    • callback("FINISHED", task_name)
  • task_name : the name of the task
  • args : tuple of arguments that will be given to the function
  • kwargs : dict of keyword arguments that will be given to the function
  • daemon : (True, False, None) : Whether main thread has to wait for thread to finish before stopping main thread
  • add_task(new_task) : Adds a new task obj, if there is no threads running will start one
  • get_current_task() : Allows for the current task that is executing to be returned
  • tasks_left() : Returns the number of tasks left to be completed, includes currently executing task if any.
  • add_from_func(callback, task_name) : used as a decorator which acts as add_task()



  • New decorator method that allows for adding to a Task_Queue obj


First version

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for threaded-task-executor, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size threaded_task_executor-1.1-py3-none-any.whl (5.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size threaded-task-executor-1.1.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page