Generally speaking, anytime that you accidentally get a medication in your eyes, you should seek medical help, either from your primary care doctor
or from your eye doctor
Most medications will have brief instructions as part of their packaging that describe what to do immediately after getting the medication in the eye. This often includes flushing the eye with water for several minutes, removing contact lenses
, and the like. Therefore, I would first recommend that you take a look at the packaging for the particular medication that you have to see what it recommends and follow these instructions.
After following these emergency instructions, the next step is to go see the doctor. This is important because sometimes there can be continuing damage to the eye, especially if the medication is not entirely removed, despite following the emergency instructions. This damage may require medical treatment, for example with eye patching or with topical eye medications, and close followup to make sure that the eye is healing well.
Therefore, I would book an appointment with your doctor right away to be seen. If you can't get in to see your doctor soon, another option would be to visit the emergency room (especially if the pain in the eye is severe).