Broadway composer, lyricist and playwright Robert Lopez ’97 emerged on the scene with the Tony Award-winning musical “Avenue Q,” an existential comedy featuring puppet sex and Gary Coleman. The play, which asked audiences, “What do you do with a B.A. in English,” attracted a new crop of college-aged theatergoers and caught the eye of two veterans of the comedy world, “South Park” creators Matt Stone and Trey Parker. A chance post-show conversation led to a partnership that resulted in a controversial Broadway play about the Church of Latter Day Saints. WEEKEND chatted with Lopez about parenting, Yale theater and J.R.R. Tolkien shortly before before the first preview of “The Book of Mormon,” which opened Thursday night at the Eugene O’Neill Theater.

Q. How did the “South Park” guys approach you for “The Book of Mormon”?

A. Early in the run of “Avenue Q” on Broadway, I was at the theater one night and the house manager pointed to some guys in the audience and said, “Your friends are here.” I looked over and it was Matt and Trey. “South Park” was hugely inspirational for “Avenue Q.” I … brought them across the street for a drink, and we just got to talking.

They asked me what’s next, and I said something about Joseph Smith and the Mormons … and they said, “That’s coincidental. That’s what we wanted to do for the past 10 years.” It was one of those crazy times you meet a celebrity hero and it goes well.

Q. Matt and Trey seem to love musicals.

A. Even “Orgazmo” [a 1998 comedy written by Parker and Stone] was supposed to be a musical. Of everything they’ve done, this most closely resembles “Orgazmo” because it’s about missionaries. But from another angle, it also resembles “Avenue Q” because it’s a coming of age story. It’s about being leaving one bubble and entering the real world. Instead of Avenue Q, it’s Northern Uganda.

It’s not meant to make fun of Mormonism. Ultimately, it’s about faith and the value of faith. It’s telling the story of a guy who loses faith and regains it in another way.

Q. How have you, Matt and Trey delegated tasks, and what was the writing process like?

A. We started out with the songs. It was the three of us working during “South Park” hiatus. We’d sit in a room with a piano or a demo studio rigged, and we wrote these songs almost like a band that told the story we were discussing. We talked about the songs, the characters and what the funny moments would be.

We’d been working for years during “South Park” hiatus; twice a year we’d meet for two weeks. And then we started to do workshops. Our first workshop was early 2008, and we’d do one every six months.

Q. Can you talk a little about your partnership with Jeff Marx [the composer, lyricist and playwright who collaborated with Lopez on “Avenue Q”]?

A. Jeff and I always work really well together and have a blast, but we’ve never been exclusive as collaborators. It’s been heaven working with [Matt Stone and Trey Parker], too. At Yale, my aim was to do everything myself. You get out in the real world, [and] the important thing is that the end product is good.

Q. Did taking classes with Harold Bloom GRD ’56 impact your career or “The Book of Mormon”?

A. I took “Shakespeare and Originality” and became a Bloom fan. I read “The Book of J” [by Harold Bloom] which is all about the Bible as literature, elevating the idea of literature to the realm of something that can change consciousness, humanity and history. That’s the way he looks at all literature. To me, that’s magical.

Q. Do you realize how many people will inadvertently go to bookofmormon.com looking for your musical?

A. I don’t know about that, but I bet that’s happened. Last night was our invited dress — and 100 tickets were given away through a Facebook contest. The game was to get as many people to “Like” the [“Book of Mormon”] Facebook page as you could. If you got someone to “like” the page, you “converted” them to Mormonism. And the 50 people who converted the most on Facebook got a free pair of tickets to the show.

Q. Who would you say is the target audience for “The Book of Mormon”?

A. College students. I wouldn’t say that’s our only target, but kids in college are a good match for this. I don’t know how often college students go to Broadway, but I hope that they will. It’s a smart comedy, and college kids are all about this stuff.

Q. How do you balance writing plays for children and adults?

A. I’m not sure if it’s really a balance. It’s two sides of the same thing. Most of my work has in common … this accessibility and simplicity that’s good for comedy in general. It doesn’t upstage the lyrics. Strong melody. [It] doesn’t feel terribly different. It’s just using different colors.

It’s the same experience of having a family, yet being an adult. You have one responsibility caring for a kid and wanting to keep the kid’s sense of wonder, but you’re still someone who’s went through college and had adult experiences and wants to write about that too.

Q. How many plays did you write at Yale?

A. I did three. The first show was called “All Grown Up.” It’s a musical about kids played by adults. It’s a nursery-school musical — they have a mock wedding and all get divorced.

I did one inspired by an American literature class called “Down Bleeker Street” about intellectuals in Greenwich village in the early part of century.

The third one was sort of like “Who’s Afraid of Virginia Woolf,” but it was a musical. We didn’t really understand what being in your forties and drunk was like.

Q. It’s a great time for student playwrights at Yale. The DRAMAT has produced a student-written play for its past three seasons.

A. I love that that’s the direction it’s going in. I think the musical theater direction at Yale has improved too. It used to be more of an extracurricular. Now actors can study musical theater. It’s really becoming a great program.

Q. Do you have any advice to aspiring playwrights graduating this May?

A. Try to be prolific. Moving to New York if you’re interested in theater, moving to Hollywood if you’re interested in movies or television. You have to know people. In order to get into working relationships with anyone, they have to know who you are. Asking yourself why you’re writing and why the world needs what you’re doing. Investigating what it is that makes you write. it’s important to be writing for the right reasons. There are so many wrong reasons for writing.

Q. How did your experiences as a Spizzwink(?) shape your writing career?

A. The Spizzwinks are still my best friends, longest-lasting friends from college. Some of them are coming to opening. Some of them were at my wedding. I first got my inkling in college that I might not want to just write serious stuff. That music could be funny. That was something I enjoyed doing. The Spizzwinks were really the first place where I started dabbling with that.

Q. Did you ever feel like a Mormon traveling the world with your a cappella group?

A. There’s something incredibly clean-cut about Yalies in their coat and tie. It’s very much like the Mormons, for sure. The vocal writing in “Book of Mormon” is pretty cool. I did a little of it, but we have a vocal arranger name Stephen Oremus who has written some amazing harmony that they sing while — amongst other things — tap dancing and pop and locking. It’s an amazing ensemble. [We could] get further in international relations in the world if we had more a cappella singing happening behind the scenes.

Q. Did you spend a lot of time with Mormons before working on the play?

A. We talked to a ton. We went to Salt Lake. Before we wrote any songs, we went to restaurants in Salt Lake City. They all knew Matt and Trey because of “Orgazmo,” and these guys came out of the kitchen dying to tell them stories about their mission.

One in particular — this guy went to Cambodia and saw some horrible stuff and had to leave early. They really go everywhere.

The very first number is a song called “Hello” where we see a number of missionaries walk on stage and press invisible door bells. Kind of like the telephone song in “Bye Bye Birdie.” White guys pressing door bells and singing, “Hello! My name is this … would you like to have this special book. …” You get a sense of how naïve they are.

For our two main characters, we reveal Uganda as the worst kind of third world. First their bags are stolen by these thugs and the guy that was supposed to be there to pick him up finally gets there and teaches them this foreign phrase. They get into this song, like a “Hakuna Matata” type song. But when it’s done, they learn the phrase means “Fuck you, God” for all the things that happen there.

It’s meant to be controversial and outrageous, but the story beat is that this is a place that God forgot. So, “Suck my balls, God.” That sort of thing. But where they end is, “Thank you, God.” You can’t get to “Thank you, God” unless you start with “Fuck you, God.”

Q. Have you ever thought about collaborating with Yale alum Alex Timbers ’01 [writer/director of “Bloody Bloody Andrew Jackson” fame]?

A. Yeah, we’re working on a project together. He, Kristen [Anderson, Lopez’s wife] and I are working together on a project we’re super-duper excited about. I played a song from the show to a group of Yalies.

Q. What did you do immediately after college?

A. Right out of college I lived with my mom and dad. I lived with them for four years after college. They were extremely supportive of me. Without that, I don’t know where I’d be. BMI Theater Workshop, Playwright’s Horizons internship. Met Jeff Marx and Kristen Anderson at BMI. It was kind of one-stop shopping for me. They gave us an audience of like-minded peers, a pool of collaborators, instruction, giving us a common vocabulary, ways to think about musicals.

Q. What do you say to people who hate musical theater?

A. I feel like I’m trying to connect with those people too. You can’t argue taste with someone, but you can write something that people will like. I don’t talk about musical theater. I just write. Music is an ancient art. It’s the closest you can get to communicating with people’s souls without words. As far as plays go, I’ve never written a play. I don’t go to plays anymore. I have kids; I don’t want to be bummed out.

Q. Are you trying to get professor Bloom to come to “The Book of Mormon”?

A. Oh God. I really want him to come because I think he’d like it, judging from what he wrote about “Angels in America.” The other connection is that in this show there’s a lot of reference to Tolkien’s “Lord of the Rings.” He made this connection in one of his essays: “When I read Tolkien, I am most reminded of ‘The Book of Mormon.’” It was very astute, very hilarious. They’re both kind of Bible fan fiction, in a way. Gods and heroes and minor deities. I think Tokien was ten times better than Joseph Smith. But I guess Mormons don’t read it that way.

Q. What other professors at Yale have had a big influence on you?

A. Allen Schwartz, the dean of the Music Department was one of my mentors there. He taught a class about Porter and Gershwin that helped my songwriting a lot. John Hollander, the English professor. Also, Scully [Vincent Scully 40’ GRD ’49]. Everyone loves Scully.