Watch: Rupert Grint and M Night Shyamalan discuss their creative bond
The star has now worked with Shyamalan on several occasions, appearing in new thriller Knock at the Cabin as well as his role in Shyamalan's mysterious TV series Servant.
While Servant was his first appearance in a Shyamalan project, Grint said their friendship started earlier when they first discussed working together.
"Weirdly, we nearly worked together [before]. Night nearly did a Potter movie," Grint told Yahoo Entertainment UK.
Shyamalan said: "That's how we first got to know each other, the potential to do a Harry Potter."
The duo subsequently confirmed that Shyamalan had been in the frame to direct the third Potter movie — 2004's Prisoner of Azkaban, which was eventually made by Alfonso Cuaron.
Read more: Amazing facts about Prisoner of Azkaban
Shyamalan's involvement with Potter has been the source of speculation over the years, with the director reportedly offered the first and fourth films, as well as Prisoner of Azkaban.
But years later, Grint said he appreciates his post-Potter creative freedom and that this has allowed him to work with Shyamalan on several occasions.
He said: "I love working with Night. We know each other quite well now. It feels like there's kind of a shorthand. I know what he wants from me and it works really well."
Shyamalan joked that the duo's personal friendship has even caused Grint, who is not a strong swimmer, to step outside of his comfort zone.
"I even got Rupert to swim in my swimming pool. For Rupert, that's like going all the way. It's a big deal," said the director.
He added: "They were like 'you're never getting him in the pool'. I get teary-eyed thinking about what that means."
Knock at the Cabin features Grint as one of four mysterious strangers — led by Dave Bautista's Leonard — who break into the secluded vacation cabin of a couple (Jonathan Groff and Ben Aldridge) and their daughter.
They inform the family that they have been chosen to make a terrible choice and, if they refuse, the world will come to an end.
Grint said that filming in a fully immersive 3D environment — there was a real woodland cabin, and a purpose-built studio set — made the intensity of the story really come through.
He said: "A lot of the scenes in this were five pages long. You're staying in it for so long and, when you're in it for that long, something really interesting happens in the room.
"You all sync up so even your breathing is kind of in sync. It's a really interesting thing that happens, and it keeps you completely immersed in this world."
Shyamalan said there was an unpredictability on the set that kept the energy high and allowed for the situation to develop in unusual ways.
He added: "If you're on like a TV show where they're kind of doing it rote, you might shut down a little bit and just do your rote version.
"This was the opposite. They were each not sure what the other one was gonna do. They're each inspiring each other. I found the other actors were riveted and present and forgot to protect themselves, in the best way."
Knock at the Cabin is in UK cinemas from 3 February.
Watch: Trailer for M Night Shyamalan thriller Knock at the Cabin