Python: Problem Importing Function From Another Module
        Posted  
        
            by 
                Rafid K. Abdullah
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Rafid K. Abdullah
        
        
        
        Published on 2011-01-05T09:39:33Z
        Indexed on 
            2011/01/05
            9:54 UTC
        
        
        Read the original article
        Hit count: 328
        
I have a module called nbemail.py and in this module I want to use the function package_post defined in the module main.py. I am using this statement:
from api.main import package_post
But I am getting this error:
ImportError: cannot import name package_post
I really don't know why I am getting this error! I do have _init_.py files in the api directory (which contains the files nbemail.py and main.py) and I do have the function package_post defined in main.py.
Any idea to help fixing this problem?
© Stack Overflow or respective owner