Link to home
Start Free TrialLog in
Avatar of ugeb
ugebFlag for United States of America

asked on

run a set of files in Python

I have a set of Python files -- not class files -- that each accomplish a certain task.  They contain function definitions that use the same name (not my doing), and all contain the line

if __name__ == '__main__':

which runs the functions in that py file.  I need to run all these files and aggregate the output from a single py file.  How do I do this?

I use lines like:

import ScatterValues as sv
import ScatterProcessApproach as spro

so this should import each files' functions into that namespace, correct?  So, how do I run each file given that each file is checking to see if it is "__main__"?  What's the right approach?

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of gelonida
gelonida
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ugeb

ASKER

Great, thank you for the help!