History and License - pathlib — Object-oriented filesystem paths — Python 3.11.3 ...
pathlib — Object-oriented filesystem paths. Basic use; Pure paths. General properties; Operators; Accessing individual parts; Methods and properties; Concrete paths. Methods; Correspondence to tools in the os module; os.path — Common pathname manipulations; fileinput — Iterate over lines from multiple input streams; stat — Interpreting ...
You can use something like this:
(Path(__file__).parent).joinpath('.env')
Documentation:
pathlib.Path.joinpath