At first glance this looks all correct. Does the lsusb
command show you a change in the USB devices after hot-plugging your USB stick?
If lsusb can show the hot-plugged USB device, then the actual reconnection works fine.
In that case the problem might lie with the library you are using to monitor USB devices - maybe similar to the issue I’m having with libudev for monitoring devices: libudev cannot monitor udev events inside container