I'm a python beginner and I'm trying to read a function from one python file into another. However I am getting stuck with an import error. My directories are like this:
test folder
- plot.py
- setup folder containing (mapsetup.py, empty __init __.py file)
in mapsetup.py I have the following code:
def read_files (project_name):
extent_dir =(os.path.join (dir['extents_dir'],project_name, 'extent_' + project_name + '.shp') )
and then in plot.py I have this
project_name = str(input())
sys.path.append('/Users/Documents/python/test/setup')
from setup.mapsetup import read_files
but I keep getting this error:
ImportError: cannot import name 'read_files' from 'setup.mapsetup'
PYTHONPATH)/setupis in the path then you don't wantsetup.in the import statement__init__.pyfile insetup, I think its same to assume that they do want it to be a package.sys.path.append('/Users/Documents/python/test')?