How to define the slots which can be set within a custom action and accessed in subsequent actions or responses. (Slots which dont fill their values from user inputs)

Below is the model action which returns a slotset :

class MyCustomAction(Action):
    def name(self) -> Text:
        return "my_custom_action"

    def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict) -> List[Dict[Text, Any]]:
        # Access the user_name slot
        user_name = tracker.get_slot("user_name")

        # Do some processing based on user_name
        if user_name:
            response_message = f"Hello, {user_name}!"
            response_message = "Hello, there!"

        # Set the custom_response slot to store the response message
        return [SlotSet("custom_response", response_message)]

I want that response_message to be used some where else. But if it is made to run, it states that it need that slot to be defined in domain.yml file along with slot mappings. Help me to work it out. Thanks in advance.