Should I tell my professor that I may need surgery in the middle of the semester? I am an undergrad in the second year of a 2-year transfer program at a community college. I am retaking a class that I was forced to drop a couple of semesters ago due to family issues. The instructor is the senior guy in the department for my major, and I will be taking another course with him (both are 4 credits), requiring lab work. 

The trouble is, I have known for a few months that I will need surgery. I'm on medications that are working, but the side effects in the strategic term are disastrous. The surgery will leave me bedridden for 3 days to 3 weeks.I am assuming at this point that I will have at least some flexibility in scheduling the surgery. I thought I could get it done over summer break, but that's next to impossible at this point.

So far as I can tell, these are my options;


Tell the instructor immediately (via email) or the first day of class.
Tell the instructor once I have any clarity regarding scheduling, in the hope that I can get it done over winter break.


Since this is a specialist in my major, who can help me with career guidance, references, and hands-on skills, I really want to make the best possible impression. His opinion of me is even more important as I expect to transfer next semester and would like to get As for both courses. 

Unfortunately, in addition to making me unable to finish the semester with him, the aforementioned family issues resulted in an anxiety diagnosis which required special testing arrangements. He was not super happy with that. So, on the one hand, I need this surgery as soon as possible. On the other hand, I want to avoid the perception that I am unable to handle a heavy workload for any reason. How/when should I tell him about this, if at all?
Short answer: Tell him now.

Longer answer:
As pointed out in the comments, go find the office dealing with such questions and contact them. You don't need to resort to legal rights immediately, just tell them your story and get some advice on how to proceed. They might also know things you didn't consider yet, e.g. some regulations on how much of a class you are allowed to miss, what sort of medical certificate is needed, etc.

After you cleared all questions with them, tell your instructor that you have a pressing medical issue that will force you to miss up to three weeks of class. Do that in person if possible, not via email. Ask him how to handle this and show him that you are still interested in his class and willing to take it, e.g. ask him if it is possible to get the lecture notes for these weeks and hand in the homework via email. Of course this depends on how you define "bedridden", so if you will be on heavy meds and unable to do anything, or if you will be sitting in your bed, fully alert and able to work on a laptop, but not able to stand up. I don't know what condition you have and I understand that this is private, but you should think about a plan on how to make up for the missed classes and present this plan in the discussion with the professor. This will show him that you are motivated and willing to take the class and is far easier to accept than you being gone for a few weeks and some legal office forcing him to still let you pass.
Also try to point out that you have some flexibility on when to schedule the operation and ask him for his opinion. Make clear that you can't say an exact date, but ask him if he prefers this month or that month, for example. All in all, talk to him, be frank and show motivation to make up for the missed time and you should be ok.

The above advice might also help with him not being pleased with your anxiety. It is hard for a non-professional to distinguish between anxiety and stress/fear of exams. Furthermore, some students simply say "I have anxiety", even if they are just a little stressed at the moment. Show the professor that you are still motivated for his class, that you are not trying to use your anxiety as an excuse for anything, that you are doing your best even though you have several medical conditions and he will most likely not worry about it anymore.