I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process.
For example, let\'s say I have th
p1.py:
execfile("p2.py")
p2.py:
import inspect, os print (inspect.getfile(inspect.currentframe()) # script filename (usually with path) print (os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))) # script directory