BLE and TFLite micro simultaneously

Is it possible to run both BLE and TinyML inference inside the loop() function? If so will I have to set a flag for when I need to switch to bluetooth. The pseudo code for what i propose is,

loop() {
    if ble is enabled 
        do BLE Functionalities
    else 
        run ML inference
    end if 
}