Python: 'self' is missing (not automatically being passed) in object

Viewed 389

Here is my code:

from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import Element
import xml.etree.ElementTree as etree
import os

class Accounts:
    def __init__(self):
        self.file_path = os.path.join('lib', 'accounts.xml')

    def get(self, key, value):
        tree = ElementTree.parse(self.file_path)
        print(tree)

accounts = Accounts
accounts.get('k', 'v')

I get this error:

Traceback (most recent call last):
  File ".\XML_Build.py", line 15, in <module>
    accounts.get('k', 'v')
TypeError: get() missing 1 required positional argument: 'value'

When I use accounts.get(key='k', value='v'), the error says I am missing 'self'. I have never seen this issue before. How do I pass self? I thought it was passed automatically.

2 Answers
Related