Servo Control

There is nothing in the library that knows whether attach was called in setup(), in loop(), or in some other function. So, the code you posted should work. If it doesn't the problem seems to be elsewhere in the code.