file1.py
def foo(x):
print(x)
file2.py
def foo(x):
print(x)
main.py
import file1
import file2
#User inputs either file1 or file2
variable = input()
#--
#TODO: A way to call the correct module so either file1.foo('test') or file2.foo('test')
#--
The code explains what I want to achieve but I can't find a solution to my problem, I have been looking for a couple of hours. Maybe I am just looking in the wrong place or looking with the wrong keywords. Most of the solutions online are solutions for the opposite problem. (constant module, variable function)
Please keep in mind that this is a simplified version of my actual code. In this example I could just solve it with an if-statement but in my actual project I have around 30 possible modules that could be called so it wouldn't be tidy to fix it with an if-statement.
Thanks in advance!