test.getPath
will return the location of the function or instance of class (in case of a method). You want to add parens to call the function
print(test.getPath())
Note, as pointed out by Lukas Graf, your class implementation needs to pass the self
identifier when defining methods if they are to be able to be called from an instantiated object, i.e.
def getPath(self):
...
This will allow you to do
test = File(parameter)
test.getPath()