I am creating a python module. To test it i put the file in the same directory and then wrote the code
import mymodule
mymodule.dofunction
python then said >>>no module named mymodule
but they are in the same directory.
I am creating a python module. To test it i put the file in the same directory and then wrote the code
import mymodule
mymodule.dofunction
python then said >>>no module named mymodule
but they are in the same directory.
Adapting from previous answer here. Explicitly state that you want to use the current directory.
Also, consider that you need an "__init__.py" file in each directory you are importing from.
import os, sys
lib_path = os.path.abspath('.')
sys.path.append(lib_path)
import mymodule
More information on the import system here.