I have tried using
#!/bin/bash
python ScriptA.py &
python ScriptB.py &
to run both scripts at the same time but it always returns "Invalid Syntax" with ScriptA even though all python files are in the same folder.
File that runs both scripts:
def song():
user = input()
if user == "Chance":
python ScriptA.py &
python ScriptB.py &
else:
print("Error")
The solutions i found so far, such as putting that script in one line, doesn't work as the error still shows.
--------------------------EDIT--------------------------
Both scripts run fine individually however, all the solutions you have provided still run sequentially. Script A is a video that plays via OpenCV and Script B is a song that plays via playsound.
ScriptA:
import cv2
import numpy as np
import os
os.environ['SDL_VIDEO_CENTERED'] = '1'
cap = cv2.VideoCapture("video.mp4")
while(cap.isOpened()):
ret, frame = cap.read()
if ret == True:
cv2.imshow('Frame',frame)
if cv2.waitKey(25) & 0xFF == ord('q'):
break
else:
break
cap.release()
cv2.destroyAllWindows()
ScriptB:
from playsound import playsound
a = (r"C:\Users\A\Desktop\sound.mp3")
playsound(a)
As you may tell, i'm trying to display a song alongside a video. I tried to display a video that has sound but openCV doesn't output sound for some reason. Any suggestions?