Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Module: main.py
- import os
- if __name__ == "__main__":
- chosen_function = "f1"
- if os.path.isfile(chosen_function + ".py"):
- _module = __import__(chosen_function, globals(), locals(), [chosen_function], 0)
- _module.f1()
- # Module: f0.py
- def f0():
- print("Hi, I'm f0, and I'm a function inside f0.py")
- # Module f1.py
- def f1():
- print("Hi, I'm f1, and I'm a function inside f1.py")
- # Module f2.py
- def f2():
- print("Hi, I'm f2, and I'm a function inside f2.py")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement