I have a thread class (TransmitThread) written in python which takes few parameters and then starts transmitting to a device(NI USRP). I have a rest flask based webservice,which on rest request by the user creates a new object of TransmitThread and calls the start(). Ideally it should start transmitting and wait for a flag which self.thdRunning which i can make false. I see 2 issues with my implementation 1. I do not see the prints from the Thread class 2. I store the threads in a dictionary as a reference. and when i get a subsequent rest request ,the older thread is in stopped state.
Note: I am not so familiar with Python ,i am trying to learn so any additional inputs will also be helpfull
Any input on how to keep the threads running and printing of the logs will help.
class TransmitThread(threading.Thread,grc_wxgui.top_block_gui):
    // variables are initalised here
    thdRunning = True
    def __int__(self):
        pass
    def run(self):
        ##################################################
        # Variables
        ##################################################
        self.samp_rate = samp_rate = 32000
        ....do some more thing....    
        print("Transmission started! Will wait to be killed")
        while self.thdRunning:
            time.sleep(2)
        print("Transmission thread stopped!")
    def endThreadExecution(self):
        self.thdRunning = False;
Flask rest service implementation
@app.route('/txdata/<clienID>/<usrpIp>/<frequency>/<path:fname>',methods=['GET'])
def transmit(clienID,usrpIp,frequency,fname):
    global dict
    if(not isUsrptransmiting)|shallStartTxn:
        if fname.endswith('.iq12'):
            decIM = 12
        else:
            decIM = 48
        usrpIp = "addr="+str(usrpIp)
        print(usrpIp)
        fname = "/"+fname
        transmitThread = threading.Thread(target=TransmitThread,args=(fname, str(usrpIp), decIM, frequency))
        transmitThread.daemon = True  # Daemonize thread
        print("Service is Transmitting " + str(clienID) + "this is your username " + str(usrpIp) + " freq " + str(frequency) + " file " + str(fname) +" decIM "+str(decIM))
        transmitThread.start()
        dict[str(usrpIp)] = transmitThread
        print('Service is Transmitting '+ clienID+',this is your username '+usrpIp+ ' freq '+frequency+ ' file '+ fname)
        response = {'clientId':clientID}
    else:
         response = {'clientId':"None"}
        return jsonify(response),200
