[watchdog.py] Fix write() with proper class variables