Python Obtenha localização de arquivo atual
import os
os.path.dirname(os.path.abspath(__file__))
Proud Polecat
import os
os.path.dirname(os.path.abspath(__file__))
import os
os.path.abspath(os.getcwd())
import pathlib
pathlib.Path(__file__).parent.absolute()
import pathlib
pathlib.Path().resolve()
from os import getcwd # only import "getcwd" from os
getcwd() # Get the current working directory
import inspect
inspect.getfile(<mdule name>)