Use the built-in package
getcwd method. It defaults to the root folder of the top package.
Will not work if you change the working directory. Although, an unprefixed path is common practice to be relative to the working directory.
import pathlib print(pathlib.Path.cwd()) >>> A:\Programming\Python\generalfile
CLICK HERE to find out more related problems solutions.