Pulling my hair out over all things Pythonesque in TD. First it was threading and delays and now it is checking for None Type and whether variables exist.
In the following I get a 'Invalid Run object error even though on the line before I print out t1 and get
<td.Run object at 0x00000482376452874562734>
My goal is to simply check if the run object called t1 exists and then to kill() it. ie stop the running delay.
Any feedback appreciated!
func = op('uncook').text
t1 = None
def onValueChange(channel, sampleIndex, val, prev):
print('onValueChange', val)
id1 = op('ID')[0]
global t1
global func
my_list = [id1,id2,id3,id4,id5,id6]
my_list2 = [i for i in my_list if i]
#delay before we set cooking false
d:float= 2500
if id1 is not None:
if id1 == 0:
print('first person is hidden')
op('person1').op('hold').run()
t1 = run(func, "ring1", delayMilliSeconds=d)
elif id1 > 0:
print('ASSERT first person detected t1 ',t1)
if t1 is not None:
t1.kill()