Yes, it is possible to become an airline pilot even if you wear glasses, provided that your vision, with optical correction (glasses or contact lenses), meets the parameters required by aviation regulations.
During the first-class medical examination, essential for obtaining certification, visual acuity is assessed: you must have at least 7/10 in each eye without correction, but the most important requirement is to reach 10/10 in each eye with glasses or contact lenses.
Both glasses and contact lenses are allowed, provided they are single-vision and non-tinted, and the refractive error (myopia, hyperopia, astigmatism) must not exceed certain limits. Additionally, there must be no serious ocular diseases or conditions that could compromise flight safety.
In summary: wearing glasses does not prevent you from becoming an airline pilot, as long as your vision is properly corrected and the regulatory limits are respected.