CHICAGO — “Chicago P.D.” actors were spotted filming in the Loop on Wednesday not far from where Chicago police Cmdr. Paul Bauer was fatally shot just a day earlier.

CHICAGO — “Chicago P.D.” actors were spotted filming in the Loop on Wednesday not far from where Chicago police Cmdr. Paul Bauer was fatally shot just a day earlier.

The NBC police drama had a permit to film Wednesday near 161 N. Clark St. Bauer, 53, was killed at the Thompson Center on Tuesday after chasing a man fleeing from tactical officers who tried to stop him, police said.

He is the highest-ranking officer killed in decades. Shomari Legghette was charged Wednesday with first-degree murder.

Mary May, a spokeswoman for the city Department of Cultural Affairs and Special Events, told the Tribune that the majority of Wednesday’s “Chicago P.D.” filming was inside the building at 161 N. Clark St., “with only a brief scene at the entrance. Filming was planned at the location weeks ago. They did not film at the crime scene.”

The filming did not go over well with some social media users, who took to Twitter to slam “Chicago P.D.” for being “disrespectful” and “making a mockery” by filming near the crime scene. A representative for NBC did not return a Tribune request for comment.

“Chicago P.D.,” which is in its fifth season, is part of Dick Wolf’s franchise of shows set and filmed in Chicago. Actors for “Chicago P.D.,” “Chicago Fire” and “Chicago Med” typically film in the city for about nine months each year, with breaks for holidays.

As filming got underway for Season 5 last year, showrunner Rick Eid sat down with The Hollywood Reporter and discussed the direction of “Chicago P.D.”

“The big thing that we’re trying to do is really attach the show to Chicago 2017, and to make the episodes in the show feel like it’s in the middle of that complex city right now,” Eid said.

“There’s a lot going on there socially, politically, certainly as it relates to what’s going on with the Police Department, so we just really wanted to locate the show in that rich, complicated and racially charged and socially charged and politically charged environment.”