I want to use Query Order (USER_DATA) to get my order id and then know if it's filled

I am trying to use Query Order (USER_DATA) in my code but have been getting an error
this is part of my code:

    def place_tp(self, symbol, price, t_position_amt, direction):
        response = None
            if direction == "LONG":
                response = self.sell_limit(symbol, t_position_amt, price)
            if response and isinstance(response, dict) and 'orderId' in response:
                return response['orderId']
            return response['orderId']  # Ensure you're returning the order ID here
        except Exception as e:
            print(f"Error in place_tp: {e}")
            return None  # Return None if there's any error

and also later:

tp_order_info = client.futures_get_order(symbol=self.symbol, orderId=tp_order_id)
                    if tp_order_info['status'] == 'FILLED':

but i always get an error:
SL order ID: None
Error: Unable to get order IDs for TP or SL orders.

can anyone help me?

there are a few reasons that there is no order ID in the “response”. I would suggest printing all the whole value of the “response” and check what is returned from server.