See if two examples can help.
1. I was taking a bath when the telephone rang. So I could not answer it.
2. I had already been learning French on my own for some time when my boss proposed sending me to a French class on corporate expenses, with a view to transferring me to the Paris office in 6 months' time.