You can do this, either in python or bash.
A hash/value database could be used to store the hash and values.
Take a search for gdbm tools and libraries. The original tool originated on BSD unix, gdbm is the gnu version and they are generally not distributed in the standard install these days.
I installed gdbmtool
sudo apt install gdbmtool on ubuntu (20.04) to get a utility to help me create the hash/value pairs db using bash. I sued
sha256sum again a command line utility to generate the hash on the files.
My aim was different to yours, since I wanted a tool to detect photo's (and then music) that were identical but that I had renamed in the past so that I could remove duplicates, I also had them all located under one directory so I wasn't searching across the entire filesystem. I started with a tool called
dedupe but I found that cumbersome for my needs. This was some time back, there are other tools to do the same these days (fslint, dupeguru,...).
In addition to the initial creation of the database, you will need something that is run regularly to update the db when the files are moved (renamed) to set the new path value, to the correct new location and to add new entries when they appear.
I don't think you want to hash the file name paths, but rather hash the contents of the file so that you can detect an existing identical file found in a new location.
Once you have the path of the file, it can be opened using
xdg-open from the command line (or your script).
A relational database, perhaps even
sqlite might be more appropriate, if you are wanting to track multiple paths against the same hash, because that is not allowed key-value db. But I am venturing slightly off-topic (Unix & Linux) if I go further, I have given you the names of some Unix tools to search and read up on, to get you going.