how to run a shell script every time a file is modified code example
Example: linux bash do something when file changes
while inotifywait -e close_write myfile.py; do ./myfile.py; done
while inotifywait -e close_write myfile.py; do ./myfile.py; done