-1

First, sorry if the question seems to be similar to some previously raised issues; but they didn't help me.I'm trying to use a parent class within a child one. Both classes receive the same input as below:

The parent (PA.py):

class The_Parent():
    def __init__(self,in1=None,in2=None,in3=None):
#
# and the rest of codes ...

And the child (CH.py):

class The_Child(The_Parent)
    def __init__(self,in1,in2,in3):
       The_Parent.__init__(self,in1,in2,in3)
#
#
# the rest of code ...

And now, the main function:

# import requirements and assigning the variables (in1, in2, and in3)
# 
obj = CH.The_Child(in1,in2,in3)
#
#

And the error I got:

TypeError: The_Child() takes 1 positional argument but 3 were given

Just a point, both child and parent should receive the same variables...

ir0098
  • 127
  • 1
  • 13

1 Answers1

0

If you are trying to call Parent constructor, you can call it using "super" keyword of Python, for more reference you can follow following link: How to invoke the super constructor?

justjais
  • 344
  • 3
  • 13
  • thanks guy, just managed to solve the problem using Super structure as: super(The_Parent,self).__init__(in1,in2,in3) – ir0098 Feb 09 '18 at 12:37