You can, but this is unlikely to solve your problem. I strongly suspect that this is an XY problem, and almost certainly the right solution is to revise any part of this system completely, possibly by changing the file names using unique temporary files, moving to another directory or processing library usage (libraries only do what the subscribers say, and libraries are just a code). You should not try to defeat another process; you all work for one user.
All that is said, of course, you can prevent the renaming of your own file. Just deny yourself permission. You can change the file:
chmod 400 a.txt
This means that you can read the file, but you cannot write it. However, if you already have an open file descriptor, you can continue to use it (so that you can continue to write to the file, even if there may not be another process running as the same user).
Similarly, you can change directory permissions:
chmod 500 .
This will prevent renaming, as the file names are stored in a directory.
source share