1from <file that has the class in> import <the class name you want to import>
2
3# Or do this if you want to import everything inside one file
4from <file that has the class in> import *
1#from your main script
2
3from folder.file import Klasa
4
5#OR
6
7from folder import file
8k = file.Klasa()
9
10#OR
11
12import folder.file as myModule
13k = myModule.Klasa()
14
1class myClass:
2 def __init__(self,val):
3 self.val=val
4 def getVal(self):
5 return self.val
1└── project
2 ├── package1
3 │ ├── module1.py
4 │ └── module2.py
5 └── package2
6 ├── __init__.py
7 ├── module3.py
8 ├── module4.py
9 └── subpackage1
10 └── module5.py
11
12
13from package1 import module1
14from package1.module2 import function1
15from package2 import class1
16from package2.subpackage1.module5 import function2
17