linux bash do something when file changes

C++
while inotifywait -e close_write myfile.py; do ./myfile.py; done

Source

Also in C++: