Reputation: 11
Hello everyone I am learning Python. While using Spyder I finished writing my own function (test.py) I saved the script in a new folder. In Spyder I made sure to change my working directory to where the test.py is located as well as the PYTHON PATH. Now when I try to import test it says in the console that there are no modules named 'test'. Any help will be appreciated thank you
Upvotes: 0
Views: 1549
Reputation: 11
Thank you Alex yeah the problem was I was not working in the same directory as the package I made so I opened up the command prompt in Spyder, went into the correct directory and was able to import/install it with no issues!!!
Upvotes: 1
Reputation: 180
have you tried
import sys
sys.path.append('path/to/test.py')
import test
if you want to import test
inside of another script, the most sure-fire method is to just have both scripts in the same directory
Upvotes: 0