from threading import Thread import cherrypy as cp from tableapi import TableAPI # creating instances here allows to use TableAPI etc. as singletons print(">>> start TableAPI") restapi = TableAPI() conf = { "/": { "request.dispatch": cp.dispatch.MethodDispatcher(), "tools.sessions.on": True, "tools.response_headers.on": True, "tools.response_headers.headers": [("Content-Type", "text/plain")], } } args = (restapi, "/", conf) thread = Thread(target=cp.quickstart, args=args, daemon=True) thread.start()