Advertisement
RederickDeathwill

Rodrigo's problem

Sep 9th, 2015
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. # Module: main.py
  2.  
  3. import os
  4.  
  5. if __name__ == "__main__":
  6.     chosen_function = "f1"
  7.     if os.path.isfile(chosen_function + ".py"):
  8.         _module = __import__(chosen_function, globals(), locals(), [chosen_function], 0)
  9.         _module.f1()
  10.  
  11. # Module: f0.py
  12.  
  13. def f0():
  14.     print("Hi, I'm f0, and I'm a function inside f0.py")
  15.  
  16. # Module f1.py
  17.  
  18. def f1():
  19.     print("Hi, I'm f1, and I'm a function inside f1.py")
  20.  
  21. # Module f2.py
  22.  
  23. def f2():
  24.     print("Hi, I'm f2, and I'm a function inside f2.py")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement