Import module containing class


You probably want your classes to be reusabel by multiple programs, so it is better to put the class and your code using it in separate files right from the beginning. In this example you can see how to do that importing the module and then using the dot notation to get to the class.

examples/oop/create/import_module.py
import shapes

p = shapes.Point()
print(p)          # <shapes.Point instance at 0x7fb58c31ccb0>

examples/oop/create/shapes.py
class Point:
    pass