Getting List Functions In File That Imported A Module
This is for a project I am working on to help my own workflow, and nothing that is for production. So I understand that what I am doing is probably definitely not the right thing t
Solution 1:
If you know what module you are going to import B.py in then you could have something like this:
A.py
import B
deff1():
return1deff2():
return1deff3():
return1if __name__=="__main__":
print temp.allF()
B.py
import inspect, A
def allF():
return inspect.getmembers(A, inspect.isfunction)
When you run A.py it will give you a list of functions. I'm not sure if there is a way to access the script which imports a given module, but if this is possible then you could change B.py slightly to use this.
Post a Comment for "Getting List Functions In File That Imported A Module"