EVER failed? No matter. Try again. Fail again. Fail better.

Gregor Sharp isn’t wearing a T-shirt emblazoned with Beckett’s quote when we meet at BBC Scotland’s Pacific Quay but there’s little doubt it’s fairly ingrained into his fair-haired head.

Sharp’s story as a writer reveals a career with more on-off moments than a demonstration TV set in Currys. Right now, he and writing partner Simon Carlyle are riding high, enjoying the accolades for the opening of their third BBC Two series of the caustic, clever domestic comedy Two Doors Down.

Sharp is also a BBC comedy commissioning editor, commuting to London from his home in Glasgow’s West End.

However, the 48-year-old’s fresh face belies the fact he’s had to work long and hard to make it happen. Failing hard. Failing often. Even, at one point, failing to land a shelf-packing job in Tesco.

Yet, on rewinding, Sharp reveals he never set out to be a writer. “Growing up in Cardonald [in Glasgow’s south side] I wrote a lot of stories in primary school, read avidly and plundered the local library. But I wasn’t a bookworm, I’d be outdoors a lot on my bike. I wanted to become a football player. The media was never on the radar. Yes, I watched a lot of TV and sitcoms, but it was never going to be a career.”

Encouraged by his parents – a teacher and a lecturer – to get a “proper job” the clueless teenage Sharp attempted a Business Studies degree at Strathclyde University. And failed.

“It was the worst thing ever,” he says with a wry smile. “I was in an alien world and about to chuck it all in when I got talking to a guy outside the student union who was set to change course to English. I didn’t know that was possible. So I went back to First Year to do exactly that.”

After university, a happier Sharp knocked on the doors of journalism only to achieve sore knuckles. “You were competing against so many people,” he says of the early Nineties. “It got to the point I once applied for a job on a porno mag with Galaxy Publications.”

The hopeful didn’t make it in pornography and so decided to grasp at a teacher training position. But just as he licked his stamp on the application form, Sharp’s eye was caught by a magazine ad in which STV were looking for a “lowest level” intern. “I didn’t get the job but the interviewer later called me and asked if I wanted to come in for a few weeks to get experience in television.”

Razor-keen Sharp leapt at the chance of working in a TV station with a rampant programming schedule. But his commitment to working for nothing was sorely tested. “There was one week I didn’t have the bus fares to get in. I was signing on that day when the Head of Arts called me up and encouraged me to come back. It was a really important moment.”

After a stint stuffing envelopes, Sharp became a Junior on arts show NB and soon had hands-on experience. Within two years he was directing items and producing, putting together programmes.

Along the way he met his future wife, Angela (they now have a daughter) who would go on to become a TV producer. But Sharp also met someone who was to impact tremendously on his professional life. Simon Carlyle was “a failed washing machine model”, another freelancer working on shows such as Wheel of Fortune.

The pair connected, even though they were polar opposites. Sharp is well-dressed and fashionable but his cautious demeanour suggests he colours in inside the lines. Carlyle, on the other hand, had once dreamt of a life as a drag artist in London and had been a professional ice skater. But they shared a love of comedy.

Later, the pair found themselves working at BBC Scotland. Carlyle had moved into children’s television and began writing sketches and dressing up as a cleaner. Sharp also worked on children’s television, but saw his future in the more serious world of fly-on-the-wall documentary making. However, Carlyle persuaded his chum to come over to the light side; and the result was 2003 BBC3 sitcom Terri McIntyre: Classy Bitch, the adventures of a sunbed operative.

“Simon is very intuitive,” says Sharp. “It was all instinct with him. I was more studious about writing, channelling shows I had watched as a kid. I was more into reading Robert McKee’s Principles of Screenwriting. But that’s not Simon.”

Simon Carlyle says of his writing partner; “Gregor taught me writing structure. And I taught him all the filthy jokes I’d learned in the gay bars of Glasgow.”

Terri McIntyre ran for 22 episodes and was a minor success but Sharp points out the pair “didn’t always use to get along, especially in the early days.” He adds; “It’s hard to write comedy, stuck in a room [actually, it was Carlyle’s parents’ shed in Ayr]. You need a sense of humour to go into a shed for two months. And you also need to have a mutual veto, to be able to say ‘That’s not funny.’ Navigating all that is hard. And I had to defer to the fact Simon was the performer. He was saying the words.”

After Terri, the pair went about their separate TV lives, Carlyle acting, writing on his own. “When we found out we didn’t have a commission Simon would act or do voice over work. But I’d have to take a 12-month production job to get the same money. And we were never part of a sketch show gang or anything like that we could rely on.”

They got back together, and this time they’d fail better. In 2006 they had another crack at the big time with BBC sitcom Thin Ice. It only ran to one series. “It was funny but the world [of ice skating] didn’t really work.”

Sharp meantime found work at BBC Scotland as a researcher and three years on the pair had another chance to prove themselves with caravan park sitcom Happy Hollidays. But it didn’t move. Again, the alchemy not quite right. But this failing proved the hardest to deal with. Sharp reveals he gave up the research job to gamble on Hollidays.

“These were my worst days,” he admits. “I was trying to make it as a writer on my own. But my accounts that first year revealed I’d earned £900 in total. And you don’t get dole money.

“I was actually thinking of chucking it all in and applying for teaching jobs. At one point I even applied for a night shift in Tesco but I didn’t get it. I was over-qualified. Yet I had to bring money in to the house. It was a really tricky time.”

He recovered his resolve. He continued to write spec scripts. But at the same time couldn’t expect people to pay for them. “And I couldn’t afford to take the train to London for meetings, buy coffees or whatever. But I wrote a lot that year, three sitcoms, a film script, trying to generate my own leads.”

He wrote again with Carlyle, this time coming up with one-off comedy No Holds Bard in 2009. It was funny. It was dark. The pair were coming to find their voice. But it led to nowhere. The writers came up with another idea, based on suburban family lives in Scotland. Two Doors Down was transmitted as a one-off comedy drama in 2013, commissioned by BBC Scotland. But it wasn’t picked up as a series.

Given the critical acclaim for the show, Sharp could have been forgiven for reaching for the anti-depressants. Yet at least the pair had failed far better. And they split again. But fate kicked in. The writer had been earmarked for a comedy commissioner job with the BBC in London . “I wasn’t trying to build a career in this way, but I guess I had acquired some of the skills.”

The job proved to be a massive change in material and professional fortunes. Sharp was now commuting to London to work but from trying to interest producers in his own work, he was now dealing with indies, processing programmes onto television. “In the first week, I was working with Hat Trick Productions who were making the second series of Episodes and I was suddenly at dinner with Matt LeBlanc and Friends writer David Crane. Then on the Wednesday, it was meetings with the Head of BBC One and working on Outnumbered.”

He smiles. “To get a view of the world from that side of the fence was amazing. So different from stuffing envelopes at STV.”

He loved this new world. “Although people think this is a world populated by media w******, this wasn’t the case. It was full of smart, clever, funny people and it was a stimulating environment."

But then a surprise kicked in: Two Doors Down was still being touted round by agents and three years after the first outing it was commissioned by BBC2, to run on the network.

Sharp and Carlyle had arrived. Again. But this time they didn’t fail. They had found their dark, caustic and very funny voice.

It will be shocking if Two Doors doesn’t run to at least a fourth series and now the pair are tipped to become the next Galton and Simpson, of Tony Hancock and Steptoe and Son fame. Even better, they no longer writing in a shed; they have their own Glasgow office where they have fun writing together, and have Freddie chocolate treats after lunch.

How much of a part has self-belief played in the success? “No one teaches you to write scripts. You have to work it out for yourself and that puts so many people off but you have to keep going.”

And the pair no longer fall out. “Sometimes there are bad days in the writing room,” he says, grinning, “but we know we’re lucky to be in this position. And we’re really aware we don’t want to be a dick and spoil it all.”

Two Doors Down, BBC2, Monday, 10pm.