Multithreading in python3 affecting outcome when it shouldn't

I am using the thread module in python3. I have 2 separate threads that do not share any common globals. In facts, the only way that they can interact is indirectly through a manager function. When I try to run each file individually they give me the desired output.

However, when I try to run the 2 threads in tandem the thread that was initially instantiated works, and runs how I want it to, but the 2nd thread is killed by some sort of error. I have tried to have python send me an email if the thread dies with the error code within email. I have received no such email within the past 24 hours, and the main thread is working fine.

If someone could provide any insight to my situation that would be greatly appreciated. I am willing to provide my code if that helps.

def update_delta(self):
    pp = self.prices[len(self.prices)-1]
    self.sum_3_m =  self.sum_3_m -  self.m3_data[0] +  self.price - pp
    self.sum_m =  self.sum_m -  self.m3_data[len(self.m3_data)-(month)] +  self.price - pp
    self.sum_2_w =  self.sum_2_w -  self.m3_data[len(self.m3_data)-(week*2)] +  self.price - pp
    self.sum_w =  self.sum_w -  self.m3_data[len(self.m3_data)-(week)] +  self.price - pp
    self.sum_d =  self.sum_d -  self.m3_data[len(self.m3_data)-(day)] +  self.price - pp
    self.sum_h =  self.sum_h -  self.m3_data[len(self.m3_data)-60] +  self.price - pp
    self.sum_10_m =  self.sum_10_m -  self.m3_data[len(self.m3_data)-10] +  self.price - pp
    """ self.delta_6_m = self.sum_6_m/(6*month) """
    self.delta_3_m = self.sum_3_m/(3*month)
    self.delta_m = self.sum_m/(month)
    self.delta_2_w = self.sum_2_w/(2*week)
    self.delta_w = self.sum_w/(week)
    self.delta_d = self.sum_d/(day)
    self.delta_h = self.sum_h/(60)
    self.delta_10_m = self.sum_10_m/(10)
    self.m3_data.pop(0)
    self.m3_data.append(self.price-pp)
def init_derrivitives(self):
    """
    Initializes the derrivitive data/vars
    """
    for i in range(init_nums_derrivitives):
        cur = ret_next(i,self.loc_derrivitives)
        if i > 0:
            self.m3_data.append(cur-pp)
        pp = ret_next(i,self.loc_derrivitives)
        print(i)
    for index,i in enumerate(self.m3_data):
        """ if index > len(self.m3_data) - 6*month:
            self.sum_6_m = self.sum_6_m + i """
        if index > len(self.m3_data) - 3*month:
            self.sum_3_m = self.sum_3_m + i
            if index > len(self.m3_data) - month:
                self.sum_m = self.sum_m + i
                if index > len(self.m3_data) - 2*week:
                    self.sum_2_w= self.sum_2_w + i
                    if index > len(self.m3_data) - week:
                        self.sum_w = self.sum_w + i
                        if index > len(self.m3_data) - day:
                            self.sum_d = self.sum_d + i
                            if index > len(self.m3_data) - 60:
                                self.sum_h += i
                                if index > len(self.m3_data) - 10:
                                    self.sum_10_m = self.sum_10_m + i
        print(index)
    """ self.delta_6_m = self.sum_6_m/(6*month) """
    self.delta_3_m = self.sum_3_m/(3*month)
    self.delta_m = self.sum_m/(month)
    self.delta_2_w = self.sum_2_w/(2*week)
    self.delta_w = self.sum_w/(week)
    self.delta_d = self.sum_d/(day)
    self.delta_h = self.sum_h/60
    self.delta_10_m = self.sum_10_m/(10)

This is what goes on the 2nd thread the init_derrivitives is called when each thread initilize, and the update_delta is called every minute

The 1st thread is here

    def startup(self):
    """
    This function is what initilizes the main run function and their varriables

    This gets the derrivitive/price data from online
    """
    if self.if_get_data:
        get_last_time(self.loc,self.get_time)
        get_last_time(self.loc_derrivitives,self.get_time_derrivitive)
    for i in range(init_nums):
        self.prices.append(self.price)  
        self.price = ret_next(self.tick,self.loc)
        self.tick = self.tick +1
        print(f"{self.tick = }")

What it's supposed to is simulate the stock market and email me the current price, and the average change in price over a specific time, 3 month, 1 month, 2 week, 1 week, a day, an hour, and 10 minutes.

The price updates come through, but the average change doesn't.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum