Execute command when a file changes
Solution 1:
You might need incrond (inotify cron daemon) which will monitors changes on files and then execute scripts.
Incrond can monitor add new file, modify, delete and many more. This is an article shows what event incrond can monitor with some example.
Example for your case, you might create the file /etc/incron.d/data_upload
with the contents
/tmp/data_upload IN_CREATE,IN_MODIFY /path/to/test.py
Solution 2:
You could use entr to automatically run the script everytime a file changes by running ls /tmp/data_upload | entr -p script.py
once at startup.
Project website: http://eradman.com/entrproject/
Online man page: https://www.systutorials.com/docs/linux/man/1-entr/