Protein does not affect the rate of weight loss, but it can be taken when losing weight, because these are proteins, they are useful for muscle growth and will not add excess weight to you.
If you do not have the opportunity to eat well two hours before workout, then you can drink protein half an hour before class. The fact is that in order to properly work the whole body, you need strength and energy, which just can be gleaned from protein. In addition, practicing on an empty stomach is dangerous: you may be dizzy and even faint. Therefore, a protein shake or a low-carb protein bar will help you out.
If you ate a couple of hours before your workout, then you should not drink a shake before it. In this case, you can drink protein after training. For example, if you come home late and don't want to eat up for the night. Don't eat dinner, just have a cocktail and go to bed. Casein is suitable for this purpose, it is absorbed for a long time - about 5-8 hours, i.e. will give you a feeling of fullness all night long.
It all depends on your daily calorie intake and its daily consumption. If the consumption exceeds the intake, then you will lose weight regardless of when you consume protein.
If your pre-workout meal is 4 hours before, then you can drink protein one hour before workout. If the meal is 2 hours in advance, then it is better - after. This is just an example and you shouldn't worry about it at all. Drink whenever you want, the main thing is to comply with the condition of the daily caloric deficit.
I hope you understand that protein does not burn fat when dried, but only prevents catabolism. Most likely you should take protein after training, and after a while there should be a regular dinner made up as part of your diet. An exception will be the case when you use casein, not whey protein, then you just need to slightly reduce the calorie content of dinner, since casein is absorbed for about 4-5 hours.