J
Jay O'Connor
Is there a good way to import python files without executing their content?
I'm trying some relfection based stuff and I want to be able to import a
module dynamically to check it's contents (class ad functions defined)
but without having any of the content executed.
For example:
----------------------
def test(var):
print var
#main
test(3)
----------------------
I want to be able to import this module so I can see "ah ha, this module
defines a function called 'test'", but I don't want the code at the
bottom executed during the import.
Thanks
Take care,
Jay
I'm trying some relfection based stuff and I want to be able to import a
module dynamically to check it's contents (class ad functions defined)
but without having any of the content executed.
For example:
----------------------
def test(var):
print var
#main
test(3)
----------------------
I want to be able to import this module so I can see "ah ha, this module
defines a function called 'test'", but I don't want the code at the
bottom executed during the import.
Thanks
Take care,
Jay