EpiPens have been in short supply for months, but the problem became especially acute with back-to-school season. (Jim Bourg/Reuters)

Jim Davis, whose 8-year-old daughter, Maggie, suffers from a peanut allergy, was startled to learn that his Walgreens pharmacy did not have a single EpiPen available and wouldn’t have them in stock until well after school began.

The family keeps a stock of at least six anti-allergy pens between home and school. But they will have to rely on expired medication at home. Davis sent his only unexpired doses to Maggie’s fourth-grade class.

“You’re playing this awful roulette with your kid’s life,” said Davis, a high school teacher in Bowling Green, Ky.

A widespread shortage of EpiPens across the country could send children with serious allergies to school without the medication that prevents them from going into anaphylactic shock if they are exposed.

The scarce availability, caused by manufacturing issues and local supply disruptions, has been an issue for months. Sales of the pens typically spike during the back-to-school season, as parents buy two-packs to leave at school and refill expiring prescriptions to keep in children’s backpacks or at home. Now many parents are heading to pharmacies for fresh medications to find that they are in short supply.

The shortage — which can vary among pharmacies and is being described as “occasional spot outages” by federal regulators — presents bad options for families: Go pharmacy to pharmacy hoping to get lucky, or rely on an expired dose to save their child.

Schools often require parents to supply the medication before classes begin and typically won’t accept expired versions. Many have stashes of their own, but a program that provides free Mylan-brand EpiPens to schools is facing a backlog. Schools requesting the devices must now wait at least two months before their shipments arrive, a representative for the program said – about double the normal time frame.

It’s not clear how many children could be affected. Nearly 6 million — roughly two in every classroom — in the United States have food allergies of some sort, according to the advocacy group Food Allergy Research & Education. But not all carry the devices or are trying to fill new prescriptions. Three companies currently make the epinephrine devices, but Mylan dominates the market, selling EpiPen and an authorized generic.

Parents are worried and angry, again, at Mylan, whose pricing tactics — raising the price 500 percent over a decade to more than $600 for a two-pack — sparked a national furor over drug prices as well as a congressional inquiry.

Rajiv Malik, president of Mylan, told investors in early August that the supplies of the drug the company received from Pfizer, which manufactures the drug for Mylan, “are inconsistent and inadequate in meeting global demand, including in the U.S. As a result, supplies will continue to vary from pharmacy to pharmacy and may not always be available.”

Mylan told The Post it had no further updates on the shortages from earlier this month.

Despite limited availability of EpiPens, other companies are shipping the medicine. Amneal Pharmaceuticals said its epinephrine pens are available though its manufacturer sent “intermittent supply of product” earlier this year. The Auvi-Q injector pen, made by Kaléo, is also in stock.

“We are working closely with the manufacturers and monitoring their supply as the school year begins since this is historically accompanied by increased product demand,” Food and Drug Administration spokesman Michael Felberbaum said.

In an emergency, EpiPens are injected into the thigh to stop severe reactions triggered by food allergies or bee stings. The devices, which are sensitive to light and extreme temperatures, cannot be refrigerated, and they expire 18 months from the day they’re manufactured. By the time most patients obtain them, the expiration is slightly less than a year, according to a study by researchers at Dartmouth-Hitchcock Medical Center.

In a statement, Pfizer said that it is “exploring several options that would help stabilize supply.” Spokesman Steven Danehy said the company is seeking the advice of industry experts and making capital investments to expand manufacturing capacity.

Danehy said in an e-mail that shipments are delayed because of limited supply of certain components made by another company and because of manufacturing “process changes, which have temporarily limited capacity” that were implemented in response to a warning letter from regulators.

Last year, the FDA found that Meridian Medical Technologies, the Pfizer subsidiary that manufactures EpiPen, failed to investigate more than 100 complaints that the device malfunctioned, including cases where patients later died.

Although Pfizer said at the time there was no evidence that the patient deaths were related to the issue, it has implemented new processes to address the concerns cited in the warning letter.

On Thursday, federal regulators approved the first generic version of EpiPen, touting the approval as part of its effort to protect against drug shortages. The generic, which will be sold by Teva Pharmaceuticals USA, can be substituted at the pharmacy counter for EpiPen, without a separate prescription. But it may not launch soon enough for families urgently searching for a supply now. Teva spokeswoman Doris Saltkill said the launch would be “in the coming months” in a statement.

Jennifer Madsen, who leads federal advocacy for the food allergy group, said she is concerned about the affordability and accessibility of EpiPens during a sustained shortage. If their preferred brand is out of stock, people have the option to ask their doctors to prescribe a different one. But that can kick off the costly cycle of patients tracking down injectors that aren’t covered by their insurance.

“We are concerned that insurers may have relationships with one product,” Madsen said.

The advocacy group is urging the FDA to offer guidance on short-term solutions. On Tuesday, the organization sent a letter recommending the government clarify whether patients can use expired pens in an emergency. That could also apply to schools that have only expired medication.

The group also recommended that the FDA allow pens approved by the European Union to be imported into the United States.

Laurie Combe, president-elect of the National Association of School Nurses, said she worries about how the Mylan shortage will affect schools’ emergency stashes of EpiPens. Schools will have to become “extra vigilant” if left without that “safety net,” she said.

“We will need to reevaluate emergency plans of care,” Combe said. “What is the EMS response time in the community if we don’t have this life-saving drug? We really don’t have a lot of time to support these students.”

Liz Koman of Chesapeake, Va., started looking for EpiPen refills for her 11-year-old son, Nicholas, in late June. She wanted to give herself a head start to beat the back-to-school rush. She would need to drop off a two-pack at his school when he started sixth grade — and replace the pens they keep at home and at his grandparents’ house.

More than a month later, they’ve gotten one box from their pharmacy.

Koman says she is at the top of a growing wait list kept by her pharmacist and is increasingly anxious about whether she will get the drug in time. She wishes she could switch to the Auvi-Q, but that pen isn’t covered by her family’s health plan.

“Most people are really upset with EpiPen,” Koman said. “This is the second strike against EpiPen, unfortunately.”