importing files in python

Posted by Yosy on Stack Overflow See other posts from Stack Overflow or by Yosy
Published on 2010-03-27T13:42:05Z Indexed on 2010/03/27 18:03 UTC
Read the original article Hit count: 373

Filed under:
|
|

I have that file structure-

  1. Blog\DataObjects\User.py

  2. Blog\index.py

I want to import the function(say_hello) at User.py from index.py. I am trying this code -

from Blog.DataObjects.User import say_hello

say_hello()  

And I have that error -

Traceback (most recent call last):
  File "index.py", line 1, in <module>
    from Blog.DataObjects import User
ImportError: No module named Blog.DataObjects

© Stack Overflow or respective owner

Related posts about python

Related posts about package