I need to start the download process in the background and I use something like this:
from threading import Thread
api = TikTokApi()
def foo():
url = 'https://www.tiktok.com/@karna.val/video/6912082657761381633?sender_device=mobile&sender_web_id=6919748545793050118&is_from_webapp=1'
file = api.get_Video_By_Url(video_url=url)
print(file)
t = Thread(target=foo)
t.start()
But I get the error:
greenlet.error: cannot switch to a different thread
How can i fix it?