For Lupita Nyong’o, it didn’t take long to decide she had to be in “Queen of Katwe.”

“I committed to the film less than 10 pages into reading the script,” the actress said while in Chicago the other day. “I was so moved. I was weeping because it was the first time something this meaty had crossed my desk since ’12 Years a Slave,’ ” for which the actress won the best supporting actress Oscar in 2014.

“I was so excited about telling this uplifting, heartwarming story from the African continent that doesn’t usually get heartwarming stories told. It is a true story that is centered on this small girl who has this big dream — and she achieves it,”

“Queen of Katwe” (opening Friday) recounts the true story of Phiona Mutesi, a girl from the Katwe slums in Kampala, Uganda, who discovers she has a natural gift for the game of chess — and goes on to become a champion-level player on the international chess competitive circuit.

It wasn’t simply the script that lured Nyong’o to the film. “It was a no-brainer to have Mira Nair — a woman who was so familiar with Uganda — helm this project. I knew it was in the right hands, and that she would tell this story with the love and respect that it deserved,” said Nyong’o about Nair, well-known for her award-winning documentaries and such feature films as “Mississippi Masala,” “Monsoon Wedding,” “The Perez Family” and “Vanity Fair.”

As she talked about the children who appear in the film, Nyong’o naturally focused on her character’s daughter Phiona, played by newcomer Madina Nalwanga.

“She had never acted before, but she’s a dancer,” she said. “So she has the discipline of rehearsal and repetition. She brought that to this movie. I remember meeting her and feeling an immediate connection to her. As soon as she was introduced to me she said, ‘Hi Mom,’ and that was that.”

Still a young actress herself at 33, Nyong’o, who grew up in Kenya, reflected on watching Nalwanga work in “Queen of Katwe.”

“She was absorbed so much, so fast. From take to take I could see her finding the nuances and subtext of the role, and absorbing it more and more.

“She also taught me a lot. I asked her to show me how to shop and cook a typical Ugandan meal. She facilitated an excursion to the market with the rest of my onscreen family. She found all the ingredients, she negotiated the price down, and we went back to her house and she taught me how to make the meal. We all partook of it, including Mira. So, you see, my daughter [in the movie] taught me how to mother her, as much as I taught her acting skills!”

At the end of the film, as the credits roll, the actors are shown with the real individuals they portray on the big screen. Nyong’o admitted, “It is a big challenge and responsibility, especially when it’s such recent history. These events happened in the early 2000s up to just a few years ago. I was very aware I had a responsibility to this woman. I did sit with her to get a sense of her as I wanted to honor her, but I had to remember as an actor, at the end of the day you are only presenting a certain version of the story. In a film, you will take certain liberties — and you must — to best serve the scope of the story. You never actually become the person you portray. You are making a movie, after all.”

When told the Katwe neighborhood of Kambala truly is another “character” in the film, Nyong’o agreed.

“What I love about the way Mira told the story is that she did it from the inside out. She doesn’t present Katwe in any sort of exotic or romantic way. She had us merge into the community. … I loved working there on location, because you can’t replicate that environment. So much is happening there. Yes, these people do struggle, sometimes simply to survive, but Mira and the film show us that poverty does not define who people are. It is a condition they are working through on a day-to-day basis. But you can still stop to say hello to the bricklayer, or chat with your neighbors, even though you don’t know where your next meal is coming from.”

While Nyong’o stressed she had to interpret rather than merely mimic the personality of Nakku Harriet, the woman she plays in “Queen of Katwe,” she did note that she tried to capture one important element of her persona.

“She has a dignity in her she never ever let go of. I felt that immediately when I met her. Harriet is proof that dignity doesn’t have a price tag. Though she may have lost the roof over her head, she will not go for the easy way out and simply find a man to provide for her, to take care of her.

“She was determined to set her children and herself on a different course in life — and she achieved that.”