In your question, you indicate "outside the main file." If you did not mean "outside the class", then this will work to determine the module level variable:
myvar = 'something' class myclass: pass
Then you can do it by counting the class and variable definitions in the module named mymodule :
import mymodule myinstance = myclass() print mymodule.myvar
Also, in response to your comment in @phihag's answer, you can access myvar without qualification:
from mymodule import myvar print myvar
If you just want to open its shorthand from another file, still defining it in the class:
class myclass: myvar = 'something'
then in the file where you need to access it, assign a link in the local namespace:
myvar = myclass.myvar print myvar
zigg
source share