I've made a telegram bot and basically, when you send a video to it, it downloads its edits and then sends it back (edited). I have made it work but when someone is editing a video, which is a subprocess Python script, then the whole bot pauses until the editing is done and continues as normal. I have then re-wrote my telegram bot to work asynchronously however now it doesn't even wait for the file to be downloaded. Therefore it cannot process the filehash and runs the entire editing script before the file has even downloaded. then it sends the video which doesn't exist because the editing script hasn't finished or anything and it just breaks my entire editing script and doesn't work. can anyone help? I can provide any code. here is where my editing function is being run.
edit_video(message_text, f"{download_folder}/{str(chat_id)}/{profile}/{file_hash}.mp4", file_hash)
download_path = f"./exported/{str(chat_id)}/{profile}/{file_hash}.mp4"
await bot.send_video(chat_id=chat_id, video=open(download_path, 'rb'))
and this is the edit_video function
async def edit_video(title, the_hash, user_id):
subprocess.run(["python", "./editor.py", profile, title, the_hash, str(user_id)])
I've tried putting the entire editing script inside the function instead but it still doesn't work.