Sofia Vergara has been cast to play the voice of Bart's new teacher in an upcoming episode of "The Simpsons."

The "Modern Family" star is getting animated for "The Simpsons" for the first time, according to Fox News. Vergara, who has lent her voice to "Family Guy" and "The Cleveland Show" in the past, will be playing Bart's new attractive teacher, Mrs. Berrera, whom Bart eventually starts to develop feelings for.

"She plays special attention to him," executive producer Al Jean told Entertainment Weekly. Principal Skinner eventually stars to crush on Vergara's character also, and the two end up in a bit of a "romantic rivalry."

As for Vergara, producers are not sure if she'll return for more episodes, as Bart doesn't have a "regular teacher," but the door will be left open for her in case they decide to continue with the character. With "Modern Family" filming at the same studios, she's not far away if this were the case.

"[Sofia] was really funny and we were glad to have her," Jean said. "And as she said, 'I'm just 100 yards away on the Fox lot.'"

The episode is called "Teenage Mutant Milk-Caused Hurdles," in which Bart drinks a milk substitute with bad hormones which send him into an early puberty, causing him to have feelings for his teacher.

Season 27 of "The Simpsons" premieres Sept. 27.