Here are 2 scenarios:
1: The swelling is at the eyelid margin at the root of an eyelash. It is red and tender. Child complains of pain Dx. Style. Treat with warm compress. Do not try to squeeze.
Use Antibiotic ointment. Your physician may epilate the eyelash and release the pus. Use topical antibiotics for a few days till it resolves. Keep eyelashes clean.
2: Swelling is round, mobile, non tender, at the margin or on the eye lid. No pain. Dx. Chalazion. Treat with warm compress at least 20-30 minutes twice daily. Often times 4-6 weeks. Continue the same until it begins to leak. Be patient. Do not squeeze.
No need to consult an ophthalmologist.
Hope this helps,