# Revision history [back]

If you attach a file "mine.sage" containing a function f and you want to find the path of that file, you can do

from sage.misc.sageinspect import sage_getfile
sage_getfile(f)


This will return the location of the associated temporary file, the top of which should say

# -*- coding: utf-8 -*-
######################################################################
# This file was *autogenerated* from the file /path/to/mine.sage.
######################################################################


So read that file (using standard Python tools) and parse line 3 to get the path.