# Auther:aaron Fan
# dynamically gets the relative path path of the execution file:
Print (__file__)
#动态获取执行文件的绝对路径:
Import OS
File_path = Os.path.abspath (__file__)
Print (File_path)
#返回目录名, do not have a file name (return is a path)
Dir_path = Os.path.dirname (File_path)
Print (Dir_path)
#针对刚才的dir_path返回它的上一级目录的绝对路径 (You can do this again and again to get the absolute path to the first-level directory):
Dir_path = Os.path.dirname (Dir_path)
Print (Dir_path)
#添加一个环境变量 (only for this application):
Import Sys
#把刚才生成的那个dir_patch加进去
A = Sys.path.append (Dir_path)
#这种情况下, if there are other directories under the Dir_path directory, you can use import dirname1,dirname2 this way to call the
#也可以直接这么调用这些目中的模块 (the name of the script, do not bring. PY when calling)
#比如from dirname1 Import Main this way
#然后可以通过, Main.test () calls main.py the function or class in this script, etc.
python3--some of the necessary knowledge for collaboration between multiple catalogs