Actor Joseph Gordon-Levitt struggled to overcome his self-doubt as he drafted the screenplay for his directorial debut, Don Jon's Addiction.

The Hollywood star wrote and directed the new comedy, in which he plays a modern-day Don Juan who battles an addiction to pornography, and admits he was unsure whether his script was any good.

It was only when Gordon-Levitt showed an early draft to his Looper director Rian Johnson that he was given the confidence boost he needed to continue.

He tells The Daily Beast, "The hardest part was writing it because you're alone and when I'm alone I'm always having these moments of self-doubt like, 'Am I kidding myself? Is this any good?'

"Once I had my first draft, I showed it to Rian Johnson, who said, 'I think you really have something here.' And from then on, it got easier and the demons kind of took a break at that point."

Gordon-Levitt also insists he has learned from the best, adding, "The year before we shot this I was lucky 'cause I worked with Rian Johnson and then (The Dark Knight Rises director) Chris Nolan and then Steven Spielberg, and certainly was paying attention. One thing I've noticed that all three of those guys have in common is balancing the homework that they've done and the vision that they have with being open to having spontaneous things happen. That, to me, (is) at the crux of what a director does."