how call module in the same directory

from .posts_run import get_all_posts
#    ^ here do relative import
# or
from core.posts_run import get_all_posts
# because your package named 'core' and importing looks in root folder

Here is what the above code is Doing:
1. Importing the get_all_posts function from the posts_run module in the core package.
2. Calling the get_all_posts function and passing in the request object.
3. Returning the response object that the get_all_posts function returns.