thisfile#

thisfile(frame=1, aspath=None)[source]#

Return the full path of the current file.

Parameters:
  • frame (int) – which frame to pull the filename from (default 1, the file that calls this function)

  • aspath (bool) – whether to return a Path object

Examples:

my_script_name = sc.thisfile() # Get the name of the current file
calling_script = sc.thisfile(frame=2) # Get the name of the script that called this script

New in verison 2.1.0.