Zend certified PHP/Magento developer

Monitor mapped drive failed when screen locked

I have a python script to monitor file creation on a network drive mapped.
The script runs perfectly as i tested, but problem is that when i leave my pc unattended for sometime, it does not work anymore ( mostly around 40 mins up)

when pc is locked, i tested it works fine, but after a while, does not work again.
I have a feeling that this is related to win10 disconnects network drive or sessions

i also tried to set net config server /autodisconnect:-1
it did not help.

anyone knows how to fix it ?