-
Notifications
You must be signed in to change notification settings - Fork 0
/
import_package_outer_1_dot.py
54 lines (46 loc) · 1.55 KB
/
import_package_outer_1_dot.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Type: Standalone Module
"""
# DON'T MIND THESE IMPORTS
import sys
# from os.path import dirname,basename # already imported through children
# IMPORT MODULE: runs all code in the module, except stuff in "main" part
import utils1.example1
import utils1.example2 as e2 # renaming possible
# IMPORT THINGS: all
from utils1.example3 import * # Avoid this !
from utils1.example4 import function1 as f1, function2 as f2, function3 as f3 # single/multiple function/variable # renaming possible
# -----------------------------------
FILE = basename(__file__)
PARENT = basename(dirname(__file__))
print("IMPORT \t {}".format(FILE))
# -----------------------------------
if __name__ == '__main__':
# SHOW PYTHON PATH CONTENTS
print("SYS.PATH:")
for ele in sys.path:
print(ele)
print("----------------------------------------")
# BEGIN OF CURRENT SCRIPT
print("RUN - {} - {}".format(PARENT, FILE))
print("----------------------------------------")
# FUNCTION FROM UTILS/EXAMPLE1.PY
utils1.example1.function1()
utils1.example1.function2()
utils1.example1.function3()
print("----------------------------------------")
# FUNCTION FROM UTILS/EXAMPLE2.PY
e2.function1()
e2.function2()
e2.function3()
print("----------------------------------------")
# FUNCTION FROM UTILS/EXAMPLE3.PY
function1()
function2()
function3()
print("----------------------------------------")
# FUNCTION FROM UTILS/EXAMPLE4.PY
f1()
f2()
f3()
print("----------------------------------------")