title: Calling a method from outside a class in Python
body: <p>This is a vector class that I have been making, however, when I try to run it, it gives the following error: "NameError: name 'self' is not defined" </p>
  
  <p>If anyone could tell me what is going wrong, that would be much appreciated.</p>
  
  <p>I am fairly new to Python so any feedback on how to improve/optimize the code is appreciated as well. </p>
  
  <pre><code>class Vector(object):
  
      @staticmethod
      def __init__(self,x,y):
          self.x = x
          self.y = y
  
  
      @staticmethod   
      def __add__(self, newVector):
          return Vector(self.x+newVector.x, self.y+newVector.y)
  
  
      @staticmethod
      def __subtract__(self,newVector):
          return Vector(self.x-newVector.x, self.y-newVector.y)
  
  
      @staticmethod
      def __dotProduct__(self, newVector):
          return (self.x*other.x) + (self.y*other.y)
  
  
      @staticmethod
      def __length__(self, newVector):
          return sqrt((self.y)^2 + (self.x)^2)
  
  
      @staticmethod
      def __xTheta__ (self, Vector):
          return math.atan(math.degrees(self.y/self.x))
  
  
      @staticmethod
      def __yTheta(self, Vector):
          return math.atan(math.degrees(self.x/self.y))
  
  
      @staticmethod
      def __resolveX__(self, Vector):
          return Vector(self.x, 0)
  
  
      @staticmethod
      def __resolveY__(self, Vector):
          return Vector(0, self.y)
  
  
      @staticmethod
      def __scalarProduct__(self, scalar):
          return Vector(self.x*scalar, self.y * scalar)
  
  
      @staticmethod
      def __normalise__(self, Vector):
          return Vector(self.x/self.length(Vector),self.y/self.length(Vector))
  
  
  a = Vector(3,4)
  print(a.length())
  </code></pre>