It's been two days since Marvel Comics' legend Stan Lee passed away, and along with many fans still paying tribute to the creator, those who knew him personally have also been sharing anecdotes of their experiences with the man. Take Sam Raimi, director of 2002's Spider-Man. At that time, Lee wasn't known as the Cameo King yet, so when Raimi was asked to include Lee in the Web-Slinger's first movie, he wasn't on board with that. As Raimi recalled:
As Sam Raimi told THR beforehand, he had already met Stan Lee prior to working on Spider-Man. After Raimi's Darkman came out, Lee called the director and told him he liked the movie. The two later met for lunch, and Lee told Raimi he wanted to work with him on a Thor movie. The men wrote some treatments and pitched to 20th Century Fox, but because this was 1991, a decade before the superhero movie genre would really take off, the studio wasn't interested in the project. But in the time Raimi got to spend with Lee, he figured that the comic book writer, editor and publisher just didn't have the acting chops.
However, due to pressure from producer Avi Arad, Sam Raimi had to include Stan Lee in Spider-Man anyway, and it ultimately worked out for both Raimi and audiences. Lee briefly appears in the movie to pull a child out of danger's way, as you can see below.
Sam Raimi ended up bringing back Stan Lee for Spider-Man 2 and Spider-Man 3 as well, the former seeing Lee saving another civilian and the latter seeing him talk with Tobey Maguire's Peter Parker. Lee would later be brought back for cameos in The Amazing Spider-Man, The Amazing Spider-Man 2 and Spider-Man: Homecoming, just some of the many Marvel movies he appeared in.
It's worth noting that even before Spider-Man, Stan Lee already had some cameos under his belt, not including X-Men, where he was one of the bystanders on the beach who saw Senator Kelly emerge from the water naked. His first on-screen Marvel-related cameo was in the 1989 TV movie The Trial of the Incredible Hulk, and outside the Marvel sphere, he had a minor, yet important role in Kevin Smith's Mallrats.
Along with being a critical and commercial hit, Spider-Man was one of the first movies to popularize cinematic superheroes in the modern era. So without his appearances there and in X-Men, it's unlikely Lee's cameo resume would have been nearly as extensive as it ended up being. Although Lee has passed, he has several posthumous cameos coming up, including Spider-Man: Into the Spider-Verse and Avengers 4.