import sys sys.path.append('/path/from/smth.py') def extend_path(): sys.path.append('/path/from/smth.py:extend_path')