EDIT: I am editing the whole question in order to be more clear, and to change something that was wrong in the previous example.
Since I am really not sure how to explain the question, I will use the following example.
Let's say I have some classes that are called apple, banana and orange. I would like to create a function, that will take as an input one of these classes. Each class has a function that is called eating() that is what I want to call with the following function:
def function(banana):
a = banana.eating()
return a
The point is: if I put as an input the class apple, I would like a to take the value of apple.eating(). Hence, the name of the input variable should go in the expression somehow.
To be a bit more specific, the classes would be:
class apple:
def __init__:
blahblah
def eating(self):
blahblah
class banana:
def __init__:
blahblah
def eating(self):
blahblah