I am trying to separate my script into several files with functions, so I moved some functions into separate files and want to import them into one main file. The structure is:
core/
  main.py
  posts_run.py
posts_run.py has two functions, get_all_posts and retrieve_posts, so I try import get_all_posts with:
from posts_run import get_all_posts
Python 3.5 gives the error:
ImportError: cannot import name 'get_all_posts'
Main.py contains following rows of code:
import vk
from configs import client_id, login, password
session = vk.AuthSession(scope='wall,friends,photos,status,groups,offline,messages',   app_id=client_id, user_login=login,
                     user_password=password)
api = vk.API(session)
Then i need to import api to functions, so I have ability to get API calls to vk.
Full stack trace
Traceback (most recent call last):
  File "E:/gited/vkscrap/core/main.py", line 26, in <module>
    from posts_run import get_all_posts
  File "E:\gited\vkscrap\core\posts_run.py", line 7, in <module>
    from main import api, absolute_url, fullname
  File "E:\gited\vkscrap\core\main.py", line 26, in <module>
    from posts_run import get_all_posts
ImportError: cannot import name 'get_all_posts'
api - is a api = vk.API(session) in main.py.
absolute_url and fullname are also stored in main.py.
I am using PyCharm 2016.1 on Windows 7, Python 3.5 x64 in virtualenv.
How can I import this function?
 
     
     
     
     
    