I have a Raspberry Pi running Linux. My plan is that I can plug in a USB in the robot and have and it will run the python files. the reason I chose this method is that it allows for easy editing and debugging of the scripts.
Is there a way to execute my files when the USB is inserted?
Try to use os.path.exists to detect whether the pendrive is there in an infinite loop and when detected execute code on pendrive using os.system and break out of loop .
Auto run python file when usb inserted