Please help with global variable assigned to update_interval

On my code I am using several global variables and they work fine. However, when I am trying to use a global variable on the code below it doesn’t like it.

globals:
   - id: seconds_to_turn
     type: float
     restore_value: yes
     initial_value: '2'
     

sensor:
  - platform: ultrasonic
    name:  Obtacle Clearance
    id: ultrasonic_sensor1
    trigger_pin: GPIO05
    echo_pin: GPIO018
    update_interval: 
      seconds: !lambda 'return id(seconds_to_turn);'
    filters:
      filter_out: nan
    timeout: 9m

"Doesn’t like it " is not an error message.

Try removing the quotes around your lambda.

The quotes are required. It’s just that you can’t use a lambda there. Unless an option specifically states you can use a lambda, then you can’t.