-4

I have some code that I want to work. So basically I have multiple classes and multiple functions in those classes. The user inputs the name of the class and the function inside it but I don't know how to make it work.

This is my code:

Class = #The Users Input
Function = #The users Input

Class.Function # So I want to reference the function with the users input

I get a syntax error.

Kwuartz_
  • 3
  • 3

1 Answers1

1

Creating the classes:

class A:
    def __init__(self):
        #this function will be called everytime whenever the class is called
    def func1(self):
        #first function
    def func2(self):
        #second function

class B:
    def __init__(self):
        #this function will be called everytime whenever the class is called
    def func1(self):
        #first function
    def func2(self):
        #second function

Calling the classes:

try1=A()
try2=B()

#calling function1 of the first class
a=try1.func1()