Im using a function I downloaded somewhere however its not a function but a class and I have no clue how to call it. This is aproximately how it looks, say this is examplefile.py:
class exampleclass:
somevar = 1
def func1(self, input):
return input+somevar
def func2(self, input):
return input-somevar
def main():
hardvar = 2
examp = exampleclass()
out1 = examp.func1(hardvar)
out2 = examp.func2(hardvar)
print(hardvar,out1,out2)
if __name__ == "__main__"
main()
I just dont get how to use the functions inside of it. I tried
import examplefile
import exampleclass
from examplefile import exampleclass
some of these do import the class, then I try calling it like this
exampleclass.func1(1)
or
exampinstance= exampleclass
exampinstance.func1(1)
which both get me
TypeError: unbound method ...() must be called with ... instance as first argument (got list instance instead)
and thats what never works, I looked at several questions (such as these) here but I just dont get how it works. Maybe you guys can see what Im not getting.