This is because your current directory isn't on the PYTHON_PATH
, which is what import
searches when you call it. See the documentation.
If you want an immediate fix, you can use the following:
import sys, os
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
This adds the directory containing the script's file to the python path.
This will only work if the directory these scripts are in is set up as a package.