I\'m going through Zed Shaw\'s Learn Python The Hard Way and I\'m on lesson 26. In this lesson we have to fix some code, and the code calls functions from another script. He
Following worked for me and it seems very simple as well:
Let's assume that we want to import a script ./data/get_my_file.py and want to access get_set1() function in it.
import sys sys.path.insert(0, './data/') import get_my_file as db print (db.get_set1())