Like many international students who come to the United States for college, actor Siddharth Dhananjay knew that he had to figure out what to do about a work visa after graduation.

“You can try to get another visa, but I knew I wasn’t going to get one,” Dhananjay told NBC News. “I didn’t study computer science or math or anything, so I knew it was going to run out.”

But before the actor could find stable work that would keep him in the U.S., he had to pack his bags and head home to live with his aunt in the Indian city of Bangalore. It was only eight months later that he was back in the States, shooting "Patti Cake$," a new film starring Danielle Macdonald and Dhananjay scheduled to open Aug. 18.

“By the time I went back [to India], this movie was already going to happen, maybe,” Dhananjay said. “I was kind of lying to myself trying to find jobs back home, but I was really riding around my motorbike and eating good food.”

A philosophy and economics major, Dhananjay spent much of his time at Iowa’s Grinnell College working with two friends to make parody YouTube videos of popular R&B songs. Performing as “Dhananjay the First,” he would sing his own versions of hits like Destiny’s Child’s “Say My Name” and Mario’s “Let Me Love You.”

“We first starting doing it because Grinnell has a student film festival that people just make ridiculous videos for. It’s not arty films at all, it’s trashy on purpose,” he explained.

The positive response to their video inspired them to make more. “And at one point someone said, ‘put this online’ and the response was so positive and funny, and we were like, ‘Oh yeah, let’s keep doing this,’” Dhananjay said.

His YouTube persona was a far cry from Dhananjay’s life off-camera. Born in Southern India, he and his family moved to Jakarta, Indonesia, when he was a toddler for his father’s job. Many people have asked him why he chose to go to a small school in Iowa after living in major cities all over Asia.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

“They reached out to me and they were like, ‘Would you try to be part of this movie?’ And I was like, ‘Hell yeah, let’s do it.’

"The plan was always to come to America to study and I really wanted to go to a liberal arts smaller school,” he said. “I guess I didn’t really know what to expect from Iowa, but it was mostly just the school for me.”

In addition to creating buzz on campus and online, one of his Dhananjay the First videos caught the eye of screenwriter and director Geremy Jasper, who was working on a film about aspiring rappers. “They reached out to me and they were like, ‘Would you try to be part of this movie?’” Dhananjay recalled. “And I was like, ‘Hell yeah, let’s do it.’ And I was just graduating college and that’s when the email came.”

The film Jasper was working on would become “Patti Cake$,” a film about aspiring hip hop artists from a working class New Jersey town. The film follows Macdonald’s Patti and Dhananjay’s Jheri as they struggle for respect both at the rap battles they regularly attend and in their families and community.

Dhananjay said that he knew he wanted to be part of the film the moment he read a draft of the script. “Aside from being my first movie and all, I was excited about the project,” he said. “And then I met Jeremy and Danielle and I was like, ‘Please keep me in this.’"

As he prepared for the role of Jheri, Dhananjay said he also had to familiarize himself with what life is like in a small town New Jersey. “I didn’t really know what Jersey was like for a long time," Dhananjay admitted. “I just knew that some of my relatives live there and also the other was how people say Jersey is trashy.”

"He had such a distinct impression of what his Jersey was. And he knew that there had to be some character like me to be authentic.”

To get both Dhananjay and the Australia-born Macdonald a proper understanding of New Jersey, director Jasper took them to his home state to show them around personally, Dhananjay said. Jasper and Dhananjay also talked about the state’s significant South Asian population and how they would be represented in the film, Dhananjay added.

“For Jeremy, he had such a distinct impression of what his Jersey was,” he said. “And he knew that there had to be some character like me to be authentic.”

Dhananjay and Macdonald’s rapport is apparent throughout the film, and Dhananjay said that can be attributed in part to the fact that the pair has spent so much time in each other’s company and that the “Patti Cake$” producers had to link their visas together in order to ensure that Dhananjay received the proper work permits.

“Right now, I can only work on what she’s working on, so we should just make it a franchise,” Dhananjay joked. “Patti Cake$ 2, then three, and then “Patti Cake$: The Musical.”

Siddharth Dhananjay plays a pharmacy clerk who dreams of hip hop stardom in "PattiCake$." 20th Century Fox

Considering that the film does not exactly lend itself to becoming a franchise, it is lucky for Dhananjay that his visa struggles may soon be coming to an end. “I’m figuring out my O-1 visa right now, which means you need to prove that you are ‘an individual with extraordinary ability,’” he said. “It’s kind of harder for me because I don’t have any past credentials anywhere, this is the one thing I’ve done. So I’m just compiling all of those letters of recommendation and press about the movie.”

But Dhananjay is confident that his visa issues will soon be resolved, in large part because the film has been so well-received as it has traveled the film festival circuit. In recent months, he and the rest of the cast have traveled to the Sundance Film Festival and Cannes as they work to promote the movie. The film was picked up for distribution by Fox Searchlight after Sundance after a bidding war, according to Variety.

The actor says that he is still amazed that his acting journey began because of the YouTube videos he made in college.

"You’ve got to roll with the punches. It’s all fun and exciting and nothing has started to feel boring yet,” he said. “You never know when someone is going to come knocking and you have to be ready for when it happens.”

Follow NBC Asian America on Facebook, Twitter, Instagram and Tumblr.