Python self error

Hi, just wondering if any one could help me with the following code and its error

import torch

from myclass import myclass

def parse_option(self):
print(‘Line 7 ‘)
self.myclass = myclass
parser = argparse.ArgumentParser(‘argument for training’)
parser.add_argument(’–print_freq’, type=int, default=10, help=‘print frequency’)
parser.add_argument(‘–save_freq’, type=int, default=50, help=‘save frequency’)

print('Line 15')

def main():
print(‘Line 17’)
opt = parse_option()

if name == ‘main’:

File “”, line 22, in
File “”, line 18, in main
opt = parse_option()
TypeError: parse_option() missing 1 required positional argument: ‘self’

def parse_option(self) seems to be initialized as a class method, while you are defining it in a global namespace. Did you copy this method from a class? If so, remove the self argument and it should work.