i'm developing a system, and i have three python files. im importing frontend.py with main.py its working. but when i call the third file system.py its not working command prompt only opening and within a minute its closing automatically. if anyone can help me its great.

i have tried OS method. import OS and call the function inside a def function('system.py'). i can execute front end.py with this method its works. but with the system.py its not executing. when execute system.py only its works nicely. this is drowsiness detection system.

def sis():
    os.system('python system.py')
from tkinter import*
from scipy.spatial import distance
from imutils import face_utils
import imutils
import dlib
import cv2
from pygame import mixer




def eye_aspect_ratio(eye):
        A = distance.euclidean(eye[1], eye[5])
        B = distance.euclidean(eye[2], eye[4])
        C = distance.euclidean(eye[0], eye[3])
        ear = (A + B) / (2.0 * C)
        return ear


def alert():
   mixer.init()
   alert=mixer.Sound('Beep-Sound.wav')
   alert.play()
   alert.play()


thresh = 0.25
frame_check = 10
detect = dlib.get_frontal_face_detector()
predict = dlib.shape_predictor("D:\Drowsiness_Detection-master\shape_predictor_68_face_landmarks.dat")# Dat file is the crux of the code

(lStart, lEnd) = face_utils.FACIAL_LANDMARKS_68_IDXS["left_eye"]
(rStart, rEnd) = face_utils.FACIAL_LANDMARKS_68_IDXS["right_eye"]
cap=cv2.VideoCapture(0)
flag=0
while True:
    ret, frame=cap.read()

i want to execute this file. this is drowsiness detection code, "command prompt should not open". python file should open and work nicely.

0 Answers