How to connect odrive like odrivetool?

I used to connect odrive by odrive.find_any(serial_number=********)
but it not always works well that sometimes my python crashed.
I found that odrivetool always works well on conncet and reconncet.
I try to read the code of odrivetool.py but it’s hard to understand.

Is there any correct method to link my odrive and achieve reconnect?

Have you tried using the cancellation token arguments? I think this restarts the search whenever a new device has been plugged in.

import odrive
from fibre import Event
ctoken = Event()
odrv = odrive.find_any(search_cancellation_token=ctoken, app_cancellation_token=ctoken)
1 Like