You will believe in magic watching “Marvelous and the Black Hole,” even if its lead Sammy (Miya Cech) does not at first. The young woman happens into a bathroom at school where the Marvelous Margot (Rhea Perlman) is preparing to entertain a class of preschool students and gets pulled into being her assistant for a day. She doesn’t object when it seems like a better alternative to the business class she’s taking, though putting on a happy face is a bit too much to ask. “It’s supposed to instill a sense of wonder,” Margot insists to Sammy about the sleight of hand that wows the children yet fails to impress her. “But I’d settle for mild rage in your case.”

Sammy has a lot to be angry about after her mother’s untimely death, but in Kate Tsang’s sensational coming-of-age drama, the act of channeling that energy towards something productive becomes spellbinding, as the grief starts to gradually transform into finding direction in life that she could not have expected, with Margot’s help, nor has she had much help with at home when her father Angus (Leonardo Nam) and sister Patricia (Patricia Ko) are tending to their own wounds. When Sammy’s own imagination has shut down at the start, Tsang lets hers run wild as the teen listens to an old tape of her mom telling her the story of “The Empress and the Moon,” thrusting her inside an old Asian legend like the movies she watches on late night TV, and having the vivacious Perlman on hand as an illusionist, conjures great chemistry from the pair who have a healing effect on each other.

Tsang knows a thing or two about bringing together seemingly incongruous elements, bringing Margot and Sammy together with as much skill as she has blended mixed media in such inspired and inventive shorts as “Sherman” and “So You’ve Grown Attached,” and with her debut feature, she elegantly moves across both the artistic and emotional spectrum to deliver something special, further testament to the Tribeca Film Festival’s Untold Stories initiative that helped produce it following such films as “Nigerian Prince” and “Lucky Grandma.” With “Marvelous and the Black Hole” premiering at the Sundance Film Festival this weekend, the writer/director spoke about how her own experience growing up informed the story and giving audiences a refuge in the same way Margot does for Sammy.

How did this come about for you?

My parents got divorced when I was young and I was shuttled back and forth to their homes between Northern California and Hong Kong for a lot of my childhood. As a result, I felt really isolated and depressed and alone. During that time when I was at my mom’s place, my grandfather looked after me, and he could see that I was really struggling. He saw me with no judgements and reached out and became the friend and lifeline I needed. I suffered from insomnia a lot growing up and really bad nightmares, so at night he would tell me these fairytales to help me go to sleep. It was only later in my life that I realized that they were actually his experiences with the Japanese occupation of Hong Kong, these horrible experiences that he transformed into these magical fairytales. He taught me the power of taking something painful and making it beautiful and powerful for somebody else. That’s the same lesson that Margot teaches Sammy — a lot of their relationship is basically based on my relationship with my grandfather — and growing up, I was also influenced a lot by fantasy films by Tim Burton and [Steven] Spielberg, but they never had anybody that looked like me in them, so I wanted to make “Marvelous” as a way to make something for my younger self, to see myself in a film like this.

Was magic always your way into this?

I chose magic because it’s all about making the impossible possible, and to Sammy, getting over your grief about your mother’s death, seems like an impossible task, but it’s by doing these tiny miracles with Margot every day, it opens her up to possibility and wonder and transformation. Also I love films and [there’s] this sort of magical character that comes into a grounded world and changes everything for a character who’s in need, like Totoro or Edward Scissorhands, for example. But because for budgetary constraint and story constraints, I wanted to make it grounded thing, so I picked a magician to do that.

I had a magic consultant, Kayla Drescher, who came up with all the tricks in the film and how to technically perform them. And we had Miya and Rhea get together with Kayla and learn magic together, so it was really cool to see them both learning tricks together and starting to bond over magic together. It was really fun to just take them to magic shows too.

It seems like it must’ve been a fun film to prep for. It has such incredible production design such as the drawings on Sammy’s walls or the car that Margot drives. Were some of these things already in your head before hitting the ground running?

I love building worlds, especially slightly fantastical worlds that you can step into. And Yong Ok Lee, our production designer who also designed “The Farewell” and “Minari,” we were on the same page about what we wanted to do with this world. I gave her a look book of stuff I was into and she just ran with it. Margot’s house, [with] all those flowers, that was her, and she took the seed of my idea and just made it amazing.

What sold you on Miya to play Sammy?

Amey René, our casting director, put together a list of amazing actors to look at and we probably saw around 100 people for Sammy. We had a day where we did auditions and I connected with a few of them, but Miya was the last audition of the day, and she just blew me away. As soon as she started speaking the lines, and even when we were having our conversation, I knew she was really special. I remember leaving the audition talking to Carolyn [Mao], the producer, and being like, “Oh, my god. We found her. She is it.” We had meetings after she was cast to just talk about the story and tone, and she asked incredibly thoughtful questions about the character. It was clear that she understood Sammy — and Miya could not be further from what Sammy is in real life, but just by her line of questioning. I could tell that she really just understood this character.

How did Rhea Perlman come into the mix?

My mom was obsessed with “Cheers,” so that was on every week in our house and when it came time to look for a Margot, I wanted somebody who was going to be warm and [you] could easily see forming a friendship with Sammy and being able to get through to her. Somebody with some toughness as well, but sweetness and heart, and Rhea at all these things. We reached out and sent the script, and I got an answer within a day [because] she’s so decisive. She had all these ideas and thoughts about the characters that made it so much more rich.

Because costume does so much for making that character seem real, I can remember during the costume fittings with Rhea, she was very, very specific. She knew like, “Oh, Margot would not wear this, but she would wear this,” and then by the end it was like this amazing magician was standing in front of me. It was different than what I originally conceived because I conceived a person in a suit, but through her and the costume designer Amanda Bujak’s touch, she became this whole thing. It was definitely a major gift that I got to work with Rhea for this.

After seeing you’re earlier shorts, it seems like there’s a lot of different processes that have to be going concurrently with the production when there’s animation or in this case, the old Asian films within a film that will play in the background on Sammy’s TV. Does it become a balancing act on set?

When I write a script, I have a lot of visuals in mind that I want to hit that I’ve loved, stuff that I’ve seen from my youth and somehow I want to work in. The Wuxia film was one of them because I grew up watching midnight movies in Hong Kong on TV, so I knew I really wanted to work that in somewhere. And animation has always been present in my work because I love whimsy. I love things that take you out of the ordinary, so that was always going to be a part of my film, but I don’t think it was until the editing process that we really started to think about using animation as a way to really be able to enter Sammy’s mind, so that’s where it evolved.

Was directing a feature what you expected to be?

I made a couple of shorts with pretty intensive animation and VFX elements before, so I was pretty prepped to take on it on a bigger scale. But until you actually direct a feature, it’s the difference between running 100 yard dash to a cross-country race, so I credit having an amazing team of people behind me that were passionate. Like Carolyn, my producer, and all the department heads, who were so fun to work with. Even though there were indie filmmaking challenges, there was always something delightful on set that made it fun to go to work every day.

“Marvelous and the Black Hole” will play at the Sundance Film Festival on January 31st at 9 am MT and for a 48-window starting on February 2nd at 7 am MT.