I think you may have multiple logics in a module and want to call them from a function.
├── modules
│ └──logic.py
│
└─ main.py
modules/logic.py
def func1(word):
print('Here func1' + word)
def func2(word):
print('Here func2' + word)
def func3(word):
print('Here func3' + word)
def func4(word):
print('Here func4' + word)
def func5(word):
print('Here func5' + word)
main.py
import modules.logic as logic
def func(func_num, word):
a = [_,
logic.test1,
logic.test2,
logic.test3,
logic.test4,
logic.test5]
return a[func_num](word
if __name__ == '__main__'
func(1,'is')
func(2,'Yade')
func(3,'That's right')
func(4,'Nyoro')
func(5,'Daje')
$ python main.py
This is func1
This is func2
This is func3
This is func4
This is func5
Please let me know if there is a better way to write it.
Recommended Posts