So if you haven't got an immediate turn after TO and you're above 400AGL, you can start a turn while retracting flaps?
In general, as long as there's nothing specifically prohibiting it in the FCOM, sure. Check your copy of the FCOM for flap retraction speeds, it might have an increased speed to use if you are in a 30º bank.
Also, generally speaking, the sooner you can get the flaps up, the better your performance will be. The aeroplane flies a lot better once it is clean.
Hopefully someone with B737 specific experience can confirm for you.