-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
35 lines (28 loc) · 1019 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 1. import module next to script
import SimpleModule
from SimpleModule import simplefunction
# 2. import module from package
import Package
from Package import Module
from Package.Module import moduleMethod
# 3. import module from subpackage
from Package import SubPackage
from Package.SubPackage import SubModule
from Package.SubPackage.SubModule import subModuleMethod
# 4. import subpackage with intrapackage reference
from Package.AnotherSubPackage.AnotherSubModule import anotherSubModuleMethod
if __name__ == "__main__":
print("\n1. module next to script")
SimpleModule.simplefunction()
simplefunction()
print("\n2. module from package")
Package.Module.moduleMethod()
Module.moduleMethod()
moduleMethod()
print("\n3. module from subpackage")
Package.SubPackage.SubModule.subModuleMethod()
SubPackage.SubModule.subModuleMethod()
SubModule.subModuleMethod()
subModuleMethod()
print("\n4. intrapackage reference in submodule")
anotherSubModuleMethod()