FFMPEG / PYTHON - command works when run from cmd but fails when run from python

I'm bulding a screen record with python but i can not record more than 9 seconds using python However i can run the same exact command in cmd and it generates a video with no issue I will leave my code for analysis:

"""
script that generates ffmpeg commands to record your screen

"""
import os

class cmdGen:
    def __init__(self):
        self.fps = 60
        self.source = "desktop"
        self.encoder = 'mpeg4'
        self.hwaccel = None
        self.drawMouse = 1
        self.enableWebcam = False
        self.audList = 0
    def config(self,
                fps=None,source=None,encoder=None,
                hwaccel='unchanged',drawMouse=None,
                webcam=None,audList=None):
        if fps: self.fps = fps
        if source: self.source = source
        if encoder: self.encoder = encoder
        if hwaccel != 'unchanged': self.hwaccel = hwaccel
        if drawMouse: self.drawMouse = 0 if not self.drawMouse else 1
        if webcam: self.enableWebcam = bool(webcam)
        if audList: self.audList = audList
    def setSource(self,isWindow,windowName=""):
        if not isWindow:
            self.source = "desktop"
        else:
            self.source = "title="+windowName
    def setFps(self,fps):
        self.fps = fps
    def setEncode(self,encoder):
        self.encoder = encoder
    def getCmd(self,filename):
        print("ACK")
        finalCmd = ["ffmpeg.exe","-f","gdigrab"]
        finalCmd.extend(['-i',self.source])
        finalCmd.extend(['-framerate',str(self.fps)])
        finalCmd.extend(['-c:v',self.encoder])
        if self.encoder == 'mpeg4':
            finalCmd.extend(['-q:v','7'])
        if self.hwaccel: 
            finalCmd.extend(['-hwaccel',self.hwaccel])
        finalCmd.extend(['-draw_mouse',str(self.drawMouse)])
        finalCmd.extend(["-y", filename])
        print(finalCmd)
        return finalCmd
    def getCvtCmd(self,filename):
            # if self.rcchecked.get():
            #     self.mergeProcess = subprocess.Popen(args= ["ffmpeg","-i",'tmp/tmp.mkv','-i','tmp/tmp.wav','-i','tmp/webcamtmp.mkv','-filter_complex','[2:v] scale=640:-1 [inner]; [0:0][inner] overlay=0:0 [out]',"-shortest",'-map','[out]','-y',"ScreenCaptures/"+self.filename])
            # else:
            #     self.mergeProcess = subprocess.Popen(args= ["ffmpeg","-i",'tmp/tmp.mkv','-i','tmp/tmp.wav',"-shortest",'-y',"ScreenCaptures/"+self.filename], startupinfo=startupinfo)
        print("ACK")
        finalCmd = ["ffmpeg.exe"]
        finalCmd.extend(['-i','tmp/tmp.mkv'])
        for i in range(len(self.audList)):
            finalCmd.extend(['-i','tmp/tmp_'+str(i)+'.wav'])
        if len(self.audList) > 0:
            finalCmd.extend(['-filter_complex','amerge=inputs='+str(len(self.audList)),'-ac',str(len(self.audList))])
        # finalCmd.extend(['-c:v',self.encoder])
        '''
        if self.enableWebcam:
            finalCmd.extend(['-i','tmp/webcamtmp.mkv','-filter_complex','[2:v] scale=640:-1 [inner]; [0:0][inner] overlay=0:0 [out]','-map','[out]'])
        finalCmd.extend(['-shortest'])
        '''

        finalCmd.extend(["-y", filename])
        print(finalCmd)
        return finalCmd

if __name__ == "__main__":
    cg = cmdGen()
    cg.setEncode("h264_nvenc")
    cg.setFps(60)
    cg.setSource(False)
    print(cg.getCmd("tmp"))

Code used in cmd:ffmpeg -f gdigrab -framerate 60 -i desktop -q:v 7 -draw_mouse 1 -y tmp/tmp.mkv and when the recording had finished: ffmpeg -i tmp/tmp.mkv -i tmp/tmp_0.wav -filter_complex amerge=inputs=1 -ac 1 -y Video/Filme.mp4

Do you guys know what could be the issue?Thanks