Win.flip() cant execute upcoming condition

Hi everyone ! I am trying to play a beep sound at a random time within a certain period of time. Code for the loop looks like that:

random_time_loop = np.round(np.random.uniform(4,7), 3)
random_time_tone = np.round(np.random.uniform(2,3), 3)

current_time = np.round(time.time(), 3)
beep_time = np.round(current_time + random_time_tone, 3)
end_time = np.round(current_time + random_time_loop, 3)

print("Started :" + str(current_time))
print("RT loop {} RT tone {}".format(random_time_loop, random_time_tone))
print("Finish at {} beep at {}".format(end_time, beep_time))

while np.round(time.time(),3) < end_time:
    fixation.draw()
    win.flip()

    if(np.round(time.time(),3) == beep_time):
        std_tone.play(when=ptb.GetSecs()) #the sound itself is: std_tone.setSound(1000, secs=0.05)
        print("BEEPED at {}".format(np.round(monoClock.getTime(),3)))
        random_time_tone = np.round(np.random.uniform(2,3), 3) 
        beep_time = np.round(monoClock.getTime() + random_time_tone, 3) #reassign time
        print("NEW TONE random time {} at {}".format(random_time_tone, beep_time))

The output of this (2 trials) becomes:

“Started 1598258868.526
RT loop 5.009 RT tone 2.919
Finish at 1598258873.535 beep at 1598258871.445”

“Started 1598258877.527
RT loop 6.955 RT tone 2.191
Finish at 1598258884.482 beep at 1598258879.718”

The issue is following: when I have fixation drawn and window flipped, the condition part is never executed. It just skips it for some reason. However, if I dont use win.flip() it enters the condition and works well, but then I am not able to receive samples from EyeLink. How can I overcome this and make sure that both parts, time comparison and eye data will work?

Not sure if relevant: Version is 3.2.4, Windows 10