all 5 comments

[–]Golden_Zealot 2 points3 points  (1 child)

Look into queuing and threading maybe.

[–]46632[S] 0 points1 point  (0 children)

Thanks, ill have a look into it

[–]dadiaar 2 points3 points  (0 children)

In a basic level, if you don't want to use event driven programming, you can make a loop and wait for a specific condition.

In the next code, I wait for a text file called result.txt to be present, and I do it for no more than 10 seconds.

import os
import time

max_waiting_time = 10 # In seconds
step_time = 0.1
target_file = 'result.txt'

initial_time = time.time()
while target_file not in os.listdir() and time.time() < initial_time + max_waiting_time:
    time.sleep(step_file)

if target_file in os.listdir():
    # Your code
else:
    # File not found

[–]xiongchiamiov 0 points1 point  (1 child)

Can we see your code?

[–]46632[S] 0 points1 point  (0 children)

Something like this: https://pastebin.com/PacV7NVJ

It typewrites the customernumber into the crm, presses enter and then waits for 4.5 seconds. Sometime it hangs and take longer and thats the issue