One week after a lone gunman opened fire on police officers securing a Black Lives Matter protest in Dallas, emergency responders in Chicago will simulate an “active shooter” situation at Wrigley Field.

The emergency preparedness drill involving “simulated ammunition and flashbangs” will be held between 7 a.m. and 2 p.m. Thursday, prompting street closings around the stadium.

The exercise, involving the Chicago Police Department, the Chicago Fire Department and the city’s Office of Emergency Management and Communications, was in the works long before a Dallas sniper gunned down five police officers and injured several others.

But the timing is chilling, nevertheless.

That’s apparently why the Cubs sent a “Dear Wrigley Field Neighbor” alert to warn area residents of what they may see and hear during Thursday’s drill.

“Please note simulated ammunition and flashbangs will be used during the mock incident,” the email states.

“To accommodate the exercise, Waveland Ave. from Clinton to Kenmore avenues will be closed to vehicular and pedestrian traffic from 7 a.m. to 2 p.m. We appreciate your patience and support as we work to keep the confines friendly.”

Cubs spokesman Julian Green said the first-of-its kind Wrigley drill to simulate an “emergency response to an active shooter incident” has “been in the works for months” and is “not in response to any shooting incident,” local or national. He noted that a similar exercise was held recently at U.S. Cellular Field.

“The goal is to simulate a large-scale incident and response at a major sporting facility. We are happy to partner with law enforcement to help ensure the safest and [most] secure environment of our fans and the Lake View community,” Green wrote in an email to the Sun-Times.

Chicago Police Department spokesman Frank Giancamilli said Thursday’s “active shooter simulation” was planned six months ago to coincide with the All-Star break. It’s the latest in a series of drills aimed at reviewing “policies and procedures for an event at a major venue in Chicago,” he said.

“CPD regularly conducts training exercises and has held drills at other major venues in Chicago, such as the United Center, Soldier Field and McCormick Place. Chicago public safety agencies also work with private business to conduct drills for their own safety plans,” Giancamilli wrote in an email.

Earlier this year, Mayor Rahm Emanuel twice slammed the door on the Cubs’ request to shut down Addison and Clark on game days in the name of security.

Instead, the mayor agreed to widen the sidewalks along Addison and install barriers to prevent vehicles from getting close to the stadium.

“The world’s changed. It’s not just at airports. There’s public transportation. There are places — not just Wrigley Field but other venues that have a lot of people” that are now security risks, Emanuel said at the time.

“There are ways to achieve the security without shutting down Clark and Addison. Widening the sidewalks. Putting the bollards up can achieve the same type of security.”

The city has already installed concrete barricades to temporarily extend the sidewalk onto Addison as part of a pilot project.

Once the sidewalks are permanently widened, the Cubs are expected to seek approval to install protective bollards at strategic locations around the stadium, similar to planters installed at airports and major buildings. That will create an additional layer of protection between traffic, the stadium and pedestrians.

Multiple security meetings with the Cubs have yet to resolve the issue of how to finance the physical improvements around a stadium that was the last in Major League Baseball to install metal detectors.

But Emanuel expressed hope that U.S. Rep. Mike Quigley (D-Il.), who sided with the Cubs in a failed attempt to shut down Clark and Addison, would use his clout as a member of the U.S. House Appropriations Committee to line up federal funding for the lesser changes.

The Cubs responded to the mayoral compromise by saying the team was working to “implement a 21st Century operational plan for a three-acre ballpark built in 1914.”

“We have made our case to the city to close Clark and Addison. We continue to believe that is the right call,” Green said then.

“When you look at the footprint of this ballpark — a three-acre ballpark in a densely-populated neighborhood with sidewalks that are less than six feet from the street to the ballparks edge — that has presented some concerns for us.”

Still, the Cubs were careful not to look a gift horse in the mouth.

“The city has been very helpful . . . moving us in the right direction to protect the ballpark. The concrete barriers and increased police presence on opening night was a big step . . .  The plan to widen sidewalks and implement protective bollards will also enhance security,” Green said.

The security compromise was followed by Emanuel’s plan to give the Cubs the limited right to sell beer and wine on an open-air plaza adjacent to Wrigley. Once again, the billionaire Ricketts family who owns the Cubs had to settle for far less than what the team wanted.