title: Is there a way to make a function from a method inside a class
body: <p>I have a number class that has two methods in it:</p>
  <pre><code>    def digit_sum(self):
          &quot;&quot;&quot;Returns the sum of all the digits&quot;&quot;&quot;
          str_num = str(self.num)
          ans = Number(0)
          for item in str_num:
              ans += Number(item)
          return ans
  
      def digit_product(self):
          &quot;&quot;&quot;Returns the sum of all the digits&quot;&quot;&quot;
          str_num = str(self.num)
          ans = Number(1)
          for item in str_num:
              ans *= Number(item)
          return ans
  </code></pre>
  <p>I would like those methods to be accessible like functions, for example, I would type <code>x = digit_product(Number(54))</code>
  Is there a way to do this in python?</p>