'how to check if file has been accessed using python

I'm trying to do a python script that checks if file and/or directory has been accessed as a honeypot to alert me someone accessing areas of an Ubuntu server they shouldn't. Unfortunately the code below doesn't seem to work. During testing I was able to cat and copy the file without the timestamp changing (also tried st_mtime and st_ctime with no luck). Suggestions?

    import os
    alert_time = os.stat('temp.txt').st_atime
    print(datetime.fromtimestamp(alert_time))


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source