If you want to get the path relative to another path, use pathlib.Path.relative_to.
pathlib.Path.relative_to
My previous tips on pathlib.
Hydra: YAML-Based Config Management Made Simple
Loguru: Configure Professional Logging in a Single Line
Simplifying Type Annotations with MonkeyType