Reputation: 934
I created two Python scripts and put them in the same directory:
myfunctions.py
def f(x):
return x**2
def g(x):
return x**3
mytest.py
from myfunctions import f, g
print f(2)
print g(3)
This isn't working, how do I get this to work?
It works when the files are in my home directory, but I don't know how to make it work when they're in some other directory.
Upvotes: 1
Views: 1991
Reputation: 9699
You probably need to have empty __init__.py
file in the same directory to mark directory as a module
Upvotes: 2