your pupils are trying to change back to its normal state and you should not be shining light into your eyes anyways you could cause damage and eventually almost blind yourself . if it persists you should seek medical attentions.
It is not a good idea to shine a light to your eyes.
The reason your pupils change is to either let less or more light in for you to see. When it is dark your pupils will open to let in more light to fall on the retina at the back of your eye that takes the information to your brain.
When light is very bright, your pupil gets smaller to let in less light rays, otherwise you would get blinded by too much light. Never look at the sun directly.