Will you still get post-inflammatory hyperpigmentation if you don't let that part of the skin see sunlight for months?

Yes, if prone to it. Good question! Sunlight does not cause pih, but it can make it worse once it occurs. So pih can still occur on non-sun-exposed skin (if you are prone it) -- but it will go away faster if no sunlight hits it. (or if you wear a good sunscreen lotion every day).