Methods python in a different level directory import module
There is a folder / home / a, which has a module called b.py, how do I put him import into the program?
Method One: (part of the beginning of the analysis of the code the first case)
import sys;
sys.path.append(“/home/a/”)
import b
Method Two:
Increase in directory __init__.py file, which you can write code that executes when import, of course, can be left blank.
Import home.ab
Method three:
from home.ab import *
premise home, a __init__.py are included namely: the current directory and the parent directory of the file you want to import the file should have init.py