How to call method of LMS from CMS?

HI,
I want to use retrieve_all method of Thread model from openedx/core/djangoapps/django_comment_common/comment_client/thread.py

I want to call this from cms. But it gives me the following error:

requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘localhost’, port=18080): Max retries exceeded with url: /api/v1/threads?course_id=course-v1%3AOrg%2BCS007%2B2024&request_id=d01a2b8a-cd7f-4563-ad9d-bb9b65cb0b2a (Caused by NewConnectionError(‘<urllib3.connection.HTTPConnection object at 0x7f696e22a100>: Failed to establish a new connection: [Errno 111] Connection refused’))

I can call it from lms but not from cms. So, can anyone please provide me a solution for this? Thanks.