class MyHandler(FileSystemEventHandler):

    def on_modified(self, event):
        print('Got it!')
if __name__ == '__main__':
    event_handler = MyHandler()
observer = Observer()
observer.schedule(event_handler, path='.', recursive=False)
observer.start()
try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    pass
python watchdog monitoring file for changes