I'm writing a python program, which should fetch images from the internet. Therefore I created a main controller and an APIService. Because I want to make the controller more light, I added some functionallity into the APIServices.
Unfortunally I cant call other functions within the APIService Class, I always get the error: ("name 'fetch' is not defined").
Is there a way to call methods inside a class or isnt this supported in python?
Code example:
class APIService(object):
def __init__(self, url):
#init
def fetch(url):
#fetch Image
def fetchLogic(self, url):
for i in url:
fetch(i) #here the error accures
class Controller(object):
def __init__(self):
#init
def callAPI()
api = APIService("url")
api.fetchLogic([url1,url2])
if __name__ == "__main__":
Controller()