If I have a script like this:
import sys
def square(x):
    return x*x
def cube(x):
    return x**3
How can I return a list of all the functions defined locally in the program ['square', 'cube'], and not the ones imported.
They are included when I try dir() but so are all the variables and other imported modules. I don't know what to put into dir to refer to the locally executing file.