“I hope the exit is joyful — and I hope never to return.” Frida Kahlo confided these remarks to her diary in 1954, just a few days before making her final exit.In a new opera, “El Último Sueño de Frida y Diego” (“The Last Dream of Frida and Diego”), the composer Gabriela Lena Frank and librettist Nilo Cruz imagine Kahlo overcoming her reluctance to return from beyond. She is summoned back on the Day of the Dead with a mission: to escort her husband, Diego Rivera, to the underworld. What lures her is the prospect of being given a chance to paint once more.“Sueño,” the debut opera by Frank, 50, has had a long road to the stage. In 2007, she was invited by the Arizona Opera artistic director Joel Revzen to write a work. He suggested the Mexican painter Kahlo as an ideal topic. It resonated with her immediately.“On a personal level, the fact that Frida is a multiracial woman of color with a disability is something I can really relate to,” Frank said in a recent video interview, referring to her heritage — Peruvian-Chinese on her mother’s side, Lithuanian-Jewish on her father’s — as well as her history of hearing loss and Graves’ disease. “She lived this rich, full life that any able bodied, non-disadvantaged person would love to be able to live. And she did so through some very dangerous times in world history.”The commission from Arizona Opera fell through. But in the meantime, Frank established herself as a significant American composer, winning the Latin Grammy Award for best contemporary classical composition in 2009.Frida Kahlo’s “The Love Embrace of the Universe, the Earth (Mexico), Myself, Diego and Señor Xólotl” from 1949, which depicts Rivera as a child, embraced by Kahlo and by an earth goddess.The Jacques and Natasha Gelman Collection of 20th Century Mexican Art and the Vergel Foundation; Banco de México Diego Rivera Frida Kahlo Museums Trust, Mexico, D.F./Artists Rights Society (ARS), New YorkWhen the “Sueño” project was revived, San Diego Opera’s general director, David Bennett, took the lead. In 2015, he convinced San Francisco Opera to come onboard as a co-producer, securing the support needed to bring “Sueño” to the stage. Now, after further pandemic delays, the work will premiere at San Diego Opera on Oct. 29, with San Francisco’s production coming in June.The material is well-trodden — Kahlo’s life and work have inspired films, books, dance and Robert Xavier Rodríguez’s musical theater-tinged opera “Frida” (1991) — but Frank and Cruz determined from the outset to take a novel approach to it. Instead of dramatizing Kahlo’s physical and emotional torments and her notoriously tempestuous relationship with Rivera realistically, they embed these biographical details in the mythic context of a Day of the Dead ritual. Motifs from their paintings are integral to the story — as is the act of painting itself.“I thought: Let’s do something different,” said Cruz, 62, recalling the first time he and Frank met to discuss the project. Frank had gravitated toward Cruz, a Cuban American playwright and poet, after reading his “Anna in the Tropics,” which won the Pulitzer Prize for Drama in 2003. “It looked like a libretto,” she said, “with monologues that could obviously be arias and lots of witty banter with a great sense of rhythm that composers can get into.”Thus began a collaboration that has shaped the development of the careers of these two artists. Over the course of the opera’s prolonged incubation, the pair have worked on about a dozen projects, from a brief choral piece about the assassination of the poet Federico García Lorca to “Conquest Requiem,” an oratorio inspired by the complex, contradictory legacy of the Nahua woman Malinche and her role in Cortés’s war against the Aztecs.And the long postponement of “Sueño” had its upside. “The opera is different for having this long relationship,” Frank said.Sketches by the costume designer Eloise Kazan; above, Frida. Eloise KazanAnd, here, Catrina. Eloise KazanA rendering of a “Sueño” set, by the scenic designer Jorge Ballina.Jorge BallinaWhen they started to work on it, Frank played samples of her music for Cruz, including “Requiem for a Magical America: El Día de los Muertos” (2006), a “folk requiem” ballet originally scored for band and dancers, and “La Llorona,” a viola concerto about death and the afterlife. Cruz found these pieces so evocative that he decided to use the Mexican folk tradition of the Day of the Dead to anchor the opera.“What I love about that idea is that we go into a mythic landscape that is bigger than life,” he said. “I think those are the brushstrokes that an opera needs.”The Spanish-language libretto he wrote uses the Day of the Dead to enact a reversal of the myth of Orpheus and Eurydice — a myth central to the history of opera itself. Frida crosses the threshold from the underworld to the living for the single day allotted and guides the ailing Diego back with her as he accepts his mortality.The opera is replete with references to the pre-Columbian Mexican culture and folklore that so profoundly inspired Kahlo and Rivera. The realm where the departed souls reside is depicted as Mictlan, the Aztec underworld. Access back to the world of the living for the Day of the Dead ritual is controlled by Catrina, a trickster figure.Catrina also serves as the mouthpiece for the wit that leavens Cruz’s poetic, magic realism-inflected text. “Nothing illustrates the Mexican sense of humor and irony toward death more than the sugar-candy skulls that are made for the festivities of the Day of the Dead,” Cruz said, “as if death were sweet to eat and it can disintegrate in our mouths.”The most surprising of the opera’s quartet of characters is a young actor named Leonardo — a countertenor role — who impersonates Greta Garbo for a fan, whom Leonardo crosses over from Mictlan to visit every year.Leonardo embodies the world of art, which coexists with the worlds of the living and of the dead. The entire opera is structured around the passage among these three worlds, which are separate yet also connected. Frank said she set out to create “evocative soundscapes so that the audience is very clear when we enter a different phase of Frida and Diego’s story.”Frank established a musical vocabulary to conjure these worlds by assigning distinct gestures and instrumental colors to each: lush harmonies to evoke “the grandeur of the underworld beneath the moonlight, a big, night sound”; hints of folkloric music and lighter dance rhythms for the world of the living; and intimate, chamber music-like textures for the world of art.Diego Rivera’s “Dream of a Sunday Afternoon in Alameda Central Park,” at the Diego Rivera Mural Museum, in Mexico City.Fernando Llano/Associated PressFor authenticity, said Bennett from San Diego Opera, it was important to round out the creative team with Mexican artists and to hire native Spanish-speaking singers for the two leads. The mezzo-soprano Guadalupe Paz and the baritone Alfredo Daza will create the roles of Frida and Diego.The Mexican-born conductor, Roberto Kalb, who recently led the premiere of Tobias Picker’s opera “Awakenings,” admires the diversity of colors in Frank’s score, with the marimba threaded throughout as a unifying timbre. “She’s a master orchestrator and writes for the chorus as well as anyone,” he said. “It’s her first opera, but it doesn’t sound like it.”Frank’s references to Mexican music tend to be subtle and, for Kalb, “are always done elegantly, with great respect. As a Mexican, I appreciate that, because so many pieces just slap it on.”Kalb described the overarching tone of Frank’s music as “ancient spectralism” — referring to a focus on the phenomenon of sound itself, which she blends with an early-music flavor.“A timeless kind of sound is important,” Frank said. “That’s how Frida and Diego saw what they did. Yes, they were creating new art. But they were obsessed with old Mexican art and tradition.”Specific examples of their art influenced Cruz’s ideas for the dramatic structure. In “The Love Embrace of the Universe, the Earth (Mexico), Myself, Diego and Señor Xólotl,” from 1949, Kahlo depicts Rivera as a child, embraced by herself and by an earth goddess. Cruz said that from this image he derived the opera’s core concept of Kahlo helping Rivera cross over at the end of his life, three years after her death: “It is a self-portrait that celebrates the union of the Riveras, perhaps in the afterlife, or in a more idealistic and artistic world.”Rivera’s mural “Dream of a Sunday Afternoon at Alameda Central Park” (1946-47), which mingles his life story with a political history of Mexico, springs to life at the beginning of second act as the artist is shown painting it. Frida emerges from its composition to re-enter the world of the living.The director, Lorena Maza, who is from Mexico City, said that she and her design team took their cues from the two painters’ shared love of Indigenous and folk art, as well as their activism. But equally fundamental to the opera’s mise-en-scène are their differences in outlook: the intimacy of the self-portraits that figure so prominently in Kahlo’s work — “each one a battle against pain and disintegration” — and the social realism of Rivera’s epic murals.“Mainly what we bring to the table is the Mexican view of the story,” Maza said. “What Anglo-Saxon culture knows about the Día de los Muertos, or about Frida and Diego, is a bit different from how we live it. We want to avoid the folkloric, cliché version of this celebration and of these two artists. For us, these are very close, personal characters who have been with us since we were children and who both created a Mexican visual identity for us.”The opera’s aim, suggested by the final lines of the chorus of departed souls, is to invite us to enter into the world of Frida and Diego, to erase the borderlines between the real and the imagined:“Life is briefbut the light will followthe strokes of your paintbrush.From your paintings emerge,an anthem of sun,the glory of your gaze.” More