import os,sys self_path = os.path.join(os.getcwd(), __file__) self_dir = os.path.join(os.path.dirname(self_path), os.path.pardir) os.chdir(self_dir) sys.path.append(os.path.join(self_dir, 'lib'))