In multiple open source projects, I have seen people do os.path.abspath(os.path.realpath(__file__)) to get the absolute path to the current file.
Howeve
In the layman terms, if you are trying to get the path of a shortcut file, absolute path gives the complete path of the file present in the shortcut location, while realpath gives the original location path of the file.
Absolute path, os.path.abspath(), gives the complete path of the file which is located in the current working directory or the directory you mentioned.
Real path, os.path.realpath(), gives the complete path of the file which is being referred.
Eg:
file = "shortcut_folder/filename"
os.path.abspath(file) = "C:/Desktop/shortcut_folder/filename"
os.path.realpath(file) = "D:/PyCharmProjects/Python1stClass/filename"