Glenn Howerton and Patton Oswalt will star in NBC’s comedy pilot from writer Mike O’Brien and executive producer Seth MeyersVariety has learned.

Formerly titled “AP Bio,” the untitled project is about a hilariously cynical Ivy League professor who loses out on his dream job and goes to work as a high school biology teacher where he imposes his unorthodox teaching style and uses the kids to plot out revenge on those who wronged him.

Howerton will play the lead biology teacher, named Jack, and Oswalt will play the role of Principal Durbin.

The pilot was penned by Mike O’Brien, who will serve as executive producer with Meyers, Lorne Michaels, Mike Shoemaker and Andrew Singer. Universal TV is the studio, producing along with Michaels’ company Broadway Video.

Howerton co-created and stars on FX’s “It’s Always Sunny in Philadelphia.” With his lead casting in this NBC pilot, he becomes the second “It’s Always Sunny” star to get his own broadcast show, following Kaitlin Olson who also stars in Fox’s “The Mick.” “It’s Always Sunny” has been renewed for two more seasons, but presumably, Howerton would be able to continue on the show in some capacity, given the model set by Olson — however, both of Olson’s shows are in the Fox family, which helped to push along her casting on “The Mick.” Plus, Howerton’s roles on the FX comedy are much more time consuming than Olson’s, as he’s writer, producer and star.

For Oswalt, this is the second consecutive year in which the comedian has been cast as a series regular in a broadcast pilot. Last season, he was set in a Fox workplace comedy, which ultimately did not go to series. Though the NBC project would mark his big return to network comedy after “The King of Queens,” Oswalt has been plenty busy in the broadcast space, as the narrator on ABC’s “The Goldbergs” for the sitcom’s entire run.

Howerton is repped by WME, 3 Arts and Sloane Offer. Oswalt is repped by UTA, manager Dave Rath and attorney Lev Ginsburg.