I have a python file, with a function that I want to call in multiple places. But I want the file with the function to be in the home directory and not have to store it in every directory I want to use it. Is this possible?
For example lets say I have a py file called add.py, and it is in the home directory and its this
def add(b):
a = 3
print "ADDING %d + %d" % (a, b)
return a + b
And then in a sub directory I want to call add, how could I do that, I know if there in the same directory I could do from a import add
But in my case the add function is more complex and I want to call it in a bunch of different places without having to store multiples of the file in each directory. I know I could use init.py, but what goes in the field?
Thanks