The pycharm doesn t displaying the prints
PyCharm doesn't display the atribute values of my class

The pycharm doesn t displaying the prints
PyCharm doesn't display the atribute values of my class

 
    
     
    
    You are missing: if __name__ == '__main__':
Suppose your code is in test.py file:
class P:
    def __init__(self, attr):
        self.a = attr
p = P(4)
if __name__ == '__main__':
    print(p.a)
Run it using python test.py or via PyCharm and you will see 4 in output.
Reason:
When you execute your Python script, Python interpreter sets the variable __name__ to '__main__', the condition __name__ == '__main__' evaluates to True and print function is executed. 
When you import test.py as a module in another module, the interpreter sets __name__ to test and the print function call won't be executed.
Refer to What does if name == “main”: do? for more details.
