I have this directory structure:
- program/
- --manage_dataset/
- ----__ init__.py
- ----dir1/
- ------__ init__.py
- ----dir2
- ------__ init__.py
- ----create_patch.py
- --test/
- ---- __ init__.py
- ----launcher.py
import manage_dataset.create_patch
ImportError: No module named manage_dataset.create_patch
sys.path.insert(0,path_to_program/manage_dataset)
As I said in my comment use import create_patch
after adding to sys.path
In directory /home/rolf/program/manage_dataset there is a python program called create_patch.py
def print_patch_id():
print "Printed from create_patch.py"
Accessing it is as follows from my /home/rolf directory:
$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.insert(0,'/home/rolf/program/manage_dataset')
>>> import create_patch as cr_pat
>>> cr_pat.print_patch_id()
Printed from create_patch.py
>>>