0

I want to create a variable within a Class object that includes the location of itself, irrespective where I call it from.

I did some search and best I got was

import inspect

class test():
    def __init__(self):
        self.location=inspect.getmodule(self.__class__)

s=test()
s.location

But it doesn't give me the actual directory of the class.

How do I get something in the form of 'C:\user\...'

Felton Wang
  • 153
  • 8

0 Answers0