Quero que ao clicar numa tecla de atalho,F3, possa parar(suspender) a execussão do script Python e retomar, cada vez que Clico nesse atalho. 

OU seja, utiliza a tecla F3, para parar e continuar alternadamente e Insere essa funcionalidade neste script: 

from scipy.io.wavfile import write
import sounddevice as sd
import numpy as np
import whisper
import os


import keyboard
import json


import pyperclip




para=0
sair2=1
execao=0

tex=""
tex1=""


model = 'c:\meu\large.pt'

english = False
translate = False   # Translate non-english to english?
samplerate = 44100  # Stream device recording frequency
#samplerate = 16000  # Stream device recording frequency
#blocksize = 30      # Block size in milliseconds
blocksize = 111     # Block size in milliseconds
#threshold = 0.25    # Minimum volume threshold to activate listening
threshold = 0.0125    # Minimum volume threshold to activate listening
#vocals = [50, 1000] # Frequency range to detect sounds that could be speech
vocals = [20, 20000] # Frequency range to detect sounds that could be speech
#endblocks = 30      # Number of blocks to wait before sending to Whisper
endblocks = 8     # Number of blocks to wait before sending to Whisper
#  com small boas config endblocks = 5  blocksize = 111 

pyperclip.copy("limpezaaaa") 

class StreamHandler:
    def __init__(self):
        self.running = True
        self.padding = 0
        self.prevblock = self.buffer = np.zeros((0,1))
        self.fileready = False
        print("\033[96mLoading Whisper Model..\033[0m", end='', flush=True)
        #self.model = whisper.load_model(f'{model}{".en" if english else ""}')
        self.model = whisper.load_model(f'{model}')
        print("\033[90m Done.\033[0m")

    def callback(self, indata, frames, time, status):
        #if status: print(status) # for debugging, prints stream errors.
        if any(indata):
            freq = np.argmax(np.abs(np.fft.rfft(indata[:, 0]))) * samplerate / frames
            if indata.max() > threshold and vocals[0] <= freq <= vocals[1]:
                print('.', end='', flush=True)
                if self.padding < 1: self.buffer = self.prevblock.copy()
                self.buffer = np.concatenate((self.buffer, indata))
                self.padding = endblocks
            else:
                self.padding -= 1
                if self.padding > 1:
                    self.buffer = np.concatenate((self.buffer, indata))
                elif self.padding < 1 and 1 < self.buffer.shape[0] > samplerate:
                    self.fileready = True
                    write('dictate.wav', samplerate, self.buffer) # I'd rather send data to Whisper directly..
                    self.buffer = np.zeros((0,1))
                elif self.padding < 1 and 1 < self.buffer.shape[0] < samplerate:
                    self.buffer = np.zeros((0,1))
                    print("\033[2K\033[0G", end='', flush=True)
                else:
                    self.prevblock = indata.copy() #np.concatenate((self.prevblock[-int(samplerate/10):], indata)) # SLOW
        else:
            print("\033[31mNo input or device is muted.\033[0m")
            self.running = False

    def process(self):
        global tex1
        if self.fileready:
            print("\n\033[90mTranscribing..\033[0m")

            
            result = self.model.transcribe('dictate.wav',language='pt',task='transcribe')
           
            print(f"\033[1A\033[2K\033[0G{result['text']}")
            
           
            tex1= str(result['text'])
            
            
            print('')

            #print(i,'2 Fala agora, comprimento da frase já reconhecida é ', len(tex1))
            print('2 Fala agora, comprimento da frase já reconhecida é ', len(tex1))
            print('-----------------------------------------------')
            print(tex1) 
            print('-----------------------------------------------')
            print('')
            print('')

            #alucinaçoes:  Um abraço!  e aí  E aí  Tchau, tchau!  Inscreva-se no canal  Tchau, tchau! Deus abençoe
            
            palavra_a_remover = "..."
            tex1= tex1.replace(palavra_a_remover, "")

            #para verificar se uma variável do tipo caracteres tem menos de seis caracteres e contém a cadeira de caracteres “Tchau”.
            if len(tex1) < 20 and "Tchau" in tex1: # se não há texto, não faz nada            
                tex1 ="" 


            if tex1 =="":# se não há texto, não faz nada
                tex1 =""
            else:
                #print(tex) #escreve na linha comando
                if tex1 !='o' or tex1 !='Tchau' or tex1 !='Tchau!' or tex1 !='Tchau.':#evita que quando não se diz nada mas ouve um ruido escreva: o
                    keyboard.write(tex1+" ") #escreve na janela  de texto activa      
                    tex1 =""   
                    tex1 =""
            
            
            
            
            
            
            self.fileready = False

    def listen(self):
        print("\033[92mListening.. \033[37m(Ctrl+C to Quit)\033[0m")
        with sd.InputStream(channels=1, callback=self.callback, blocksize=int(samplerate * blocksize / 1000), samplerate=samplerate):
            while self.running:
                

                self.process()
def main():
    try:
        handler = StreamHandler()
        handler.listen()
    except (KeyboardInterrupt, SystemExit): pass
    finally:
        print("\n\033[93mQuitting..\033[0m")
        if os.path.exists('dictate.wav'): os.remove('dictate.wav')

if __name__ == '__main__':
    main()