20

I am using python to call a method in one class that is in one file from a method in another class of other file

Suppose my file is abc.py that contains

class data : 

         def values_to_insert(a,b):
               ......
                ......

another file is def.py

import abc
class values:
      data=abc.data()
      def sendvalues():
          a=2
          b=3
          data.values(a,b)

When I run this file it gives an error: values() takes exactly 2 arguments (3 given)

devnull
  • 118,548
  • 33
  • 236
  • 227
vaibhav
  • 213
  • 1
  • 2
  • 5

1 Answers1

25

If it's in a class, your method should be :

def values_to_insert(self, a, b):

You can read about the reasoning for this here.

Miklos Aubert
  • 4,405
  • 2
  • 24
  • 33