AS he steps into the room, Robert Carlyle is looking uncharacteristically nervous. Granted, the Pompadour Restaurant in Edinburgh’s Waldorf Astoria Hotel is a particularly grand space – a lot of intense white setting off listed decor done in the style of Versailles – and there’s only one other person in here, waiting for him through an ornate arch beside a window that frames the castle.

But this kind of thing should be old hat for Carlyle: an interview, a photoshoot, a new film at a festival. In fact he knows this journalist pretty well (we first met in 1991 for a magazine feature about Ken Loach’s film Riff Raff) and he’s had plenty of films screen at the Edinburgh International Film Festival (EIFF) – Priest, Trainspotting and California Solo among them.

No, the reason he’s not entirely at ease is that today he’s not just Robert Carlyle the actor, he’s also Robert Carlyle the director.

Later this evening The Legend Of Barney Thomson will open EIFF’s 2015 programme. It’s a genuine world premiere, and there’s a review embargo in place until after the screening, so not a word has been written about it yet. That’s a pressured position for any film to fill, far less one by a debuting director who is also one of Scotland’s most famous screen stars.

“It’s got to travel throughout the world,” he says, looking beyond the premiere to his film’s future. “But it was made in my own backyard, and I hope that the people who come from my own backyard give it a wee nod and understand and see it for what it is.”

He pauses. Puts a hand on the table. Has a wry smile to himself. “It’s not Taggart.”

Indeed it is not. The Legend Of Barney Thomson tells the darkly comic tale of a Glasgow barber (played by Carlyle) whose mid-life crisis spirals out of control when he is about to lose the only job he has ever known, has an accident involving a pair of scissors, a scuffle and a very dead colleague, and discovers that someone close to him is a serial killer who posts severed body parts to the victims’ families from some of the most scenic tourist spots in Scotland.

Personally, I think it’s a very funny, very black film, carefully designed to evoke a blurred sense of past-meets-present, impeccably shot with a cinematic eye and carried off with a heightened style that’s bold, unexpected and deliciously over-the-top. And in any case, it’s great to see Carlyle directing again, because those heady days with Raindog Theatre Company seem like a very long time ago.

Out of the restaurant window, on the other side of Lothian Road, I can just about see the Traverse Theatre where, in 2013, Carlyle and I last came face to face. That night I interviewed him in front of a live audience for an EIFF "in person" appearance, a 90-minute session that ranged across his entire on-screen career and included a few video clips. A week or so before that event, we had exchanged a couple of Tweets and I had jokingly referred to the upcoming encounter as a sort of Frost/Nixon scenario. “There will be no whitewash at the EIFF,” he replied at the time, riffing on one of the disgraced president’s Watergate speeches.

That wee exchange has now been retweeted or favourited from Brazil to the Czech Republic and across the US. The last time was just a few weeks ago, on June 25, a full two years after the words had been typed. Such is the global fan base this actor has accrued recently.

Over the years I’ve seen Carlyle’s face on Trainspotting T-shirts and his Full Monty denim jacket on a Madame Tussauds waxwork. But there’s something different about his fame these days, and that’s down to a younger social-network-savvy generation who have embraced this 54-year-old Glaswegian because of his leading role in American TV series Once Upon A Time.

The show, which has just been given the green light for a fifth season, casts Carlyle as Rumpelstiltskin, aka Mr Gold, one of several familiar fairytale characters who have been transported by a curse to a fictional American town in Maine called Storybrooke. Across the four seasons to date, Rumpelstiltskin has taken on other fantasy elements, so that the trickster we know from legend is also effectively Beast from Beauty And The Beast and the Crocodile from Peter Pan.

“The whole Once Upon A Time thing is a phenomenon now,” Carlyle admits. “There’s some kind of community that has gathered, and the notion of Beauty And The Beast is a big thing for them – that anyone is capable of love and being loved. They fly the flag for the Rumpelstiltskin/Belle relationship in the show. They absolutely love it and they’re so supportive. I’ve never known anything like it.

“The other day I went to the Glasgow Art School degree show and, when I was coming out, two wee girls who were about eight years old came up to get a photograph taken with their dad. Those girls don’t know Trainspotting or any of those things. They know Rumpelstiltskin. So this show has introduced me to a brand new audience who then, through Twitter, go, ‘Oh, I watched Ravenous’ or ‘I watched Face’. And I think, ‘Oh my God, they’re actually going back through the whole catalogue of my work.’ They talk about things like Hamish Macbeth, things that were on the TV when they weren’t even born. But they love it, and I’m grateful for that.”

Carlyle does indeed have much to be grateful for when it comes to American television: Once Upon A Time and, immediately before it, Stargate Universe (in which he played spaceship scientist Nicholas Rush for two seasons) have paid the bills for the past seven years. The flip side is that both shows were filmed in Vancouver, and so Carlyle has had to spend most of his working life for those seven years in Canada.

“At the time when I left, the [UK film] industry was struggling,” he explains. “There was nothing coming in and the budgets were so low that when I did Summer and I Know You Know back to back [in 2007], I ended up getting paid the same as I got paid for Riff Raff in 1990. You can only do that so often. I’d spent a whole career doing low-budget indie stuff, which definitely feeds your head but your pockets are empty. I felt that I owed it to my kids, to the family, to actually put a wee bit money in the bank and get ourselves sorted. Thankfully that’s what I was able to do.

“An actor is only an actor if he’s acting, you know? So I’m on camera every day for nine months, and it’s fantastic to get the opportunity to do that. The level of these productions is high – $3-4 million per episode. You could make two movies for that over here. And, as you know, American television has gone through the roof in the last 10 years. People wouldn’t have touched it 15 years ago, but now people are queuing up to get in, so I think I was kind of lucky to get in when I did.”

The consequence is that he and his family – wife Anastasia, daughter Ava and sons Harvey and Pearce – are currently settled in Canada, with the children attending school there. And that’s surely one of the reasons why Carlyle was happy to sign on for a fifth season of Once Upon A Time.

“I’d be a liar if I said it wasn’t part of the decisions I’ve been making,” he agrees. “But having said that, I don’t see it lasting forever. I can see that going for another couple of years perhaps and then coming back. By that point my kids will be through the early part of their school life; actually Ava will probably be nearly finished – I know, can you believe it? – because she’s turning 13 next month. So in a few years’ time she’ll be past secondary education, going into further education for whatever she wants to do. Pearce will be starting to go into secondary. My first boy, Harvey, he’s the one in the middle; he’ll be caught between the two worlds… But my bread and butter has always been here, and by the time I come back, hopefully I’ll have made a bit of money and that will afford me the opportunity to do the low-budget films I love.”

The Legend Of Barney Thomson proves, of course, that it’s not all about exile even now. It was a multi-strand Canadian-Scottish connection that brought the film to fruition, however: Canadian producer John G Lenic knew Carlyle from their work together on Stargate Universe and showed him fellow Canadian Richard Cowan’s original draft screenplay of The Long Midnight Of Barney Thomson, the first of Scotsman Douglas Lindsay’s seven-novel series about Glasgow’s unluckiest barber.

Carlyle, at first intending only to act in it, brought Scottish screenwriter Colin McLaren (Donkeys) onto the project to add more local flavour to the setting, story and dialogue. When the Canadian financiers suggested that Carlyle as both actor and director could be a neat selling hook for them, the Scot was ready to walk away.

“But,” he adds, “the more I thought about it, the more I realised, ‘Well, I know this quite well by now. I’ve actually done a director’s job on this, up to this point, so will it be easy enough for me to step in front of the camera at the same time?’ At the end, I just took a deep breath and thought, ‘You might never get another chance to do this, so whether it’s going to be difficult or not, give it a go.’”

He got around the practicalities of being simultaneously in front of and behind the camera by hiring a young acting graduate he knew, Mark Barrett, to become something more than a stand-in during rehearsal set-ups.

“Mark wasn’t walking about with the script in his hand,” insists Carlyle. “He learned it. So I could rehearse with Mark and the rest of them as many times as I liked. I was able to sit behind the monitor and talk to the camera people and say, ‘Maybe slightly to the left … maybe a different lens on that … a wee bit closer … pull back a bit.’ And then, when the cameras were ready, I’d go in and do a couple of takes. That gave it a freshness; a bit of spontaneity suddenly comes back into it as the cast realise this is a slightly different ball game.”

The result is that the performances (from a game-for-it cast featuring Emma Thompson, Ray Winstone, James Cosmo, Martin Compston, Ashley Jensen and, in hilarious form, Sir Tom Courtenay) have an extra edge and that the strange visual mood of the film evokes a Glasgow caught somewhere between then and now.

Two scenes stand out for me. In one, Carlyle and Emma Thompson (playing Barney’s beyond-gallus mother Cemolina) sit on an abandoned sofa in front of a campfire in a wasteland with the Red Road flats behind them. “Her character is falling apart, the Red Road flats are about to die, Glasgow is dying to a certain extent round about it, so it was important to get those wee dying flickers of flame,” says Carlyle.

In the other, a group of elderly Glaswegian women sit in the dark wooden shadows of the Gallowgate's Saracen’s Head pub, all singing Elkie Brookes’s Don’t Cry Out Loud at a wake. This scene has the same working-class, west-coast sentimentality you find on, say, the first Glasvegas album or at country and western nights. “I think the Scots do that hard-edged sentimentality very well,” says Carlyle. “What was in my mind there was Terrence Davies’s Distant Voices Still Lives.”

I get the feeling that the image of Glasgow Past that Carlyle has brought to this film located, ostensibly, in Glasgow Present is one that has crystallised in his head from his own childhood and, perhaps, from a few years spent geographically distant in Canada.

“You’re absolutely right in saying that the stuff I knew wasn’t really there any more, particularly in the east end,” he agrees. “The Commonwealth Games was about to kick off, Dalmarnock had been flattened. I realised we could use that to our advantage and try to use places that had a slightly ghostly element to them.

“Shawfield Dog track … I grew up there with my dad. That’s where we went every Thursday and Saturday night for years and years and years. And it’s empty now. The wee stand on the far side has trees growing out of it. You’ve also got the Barrowlands, the Sarry Heid, the Red Road flats. So, yes, they’re the Glasgow that I knew … but let’s see the Glasgow that I knew in that ghostly light.”

Scotland wasn’t just changing physically when Carlyle set to making his film, of course; in the run-up to the independence referendum, it was changing politically too. And that also had to be filtered through the experience of seven years spent on the other side of the Atlantic.

“It was kind of bewildering, to be honest,” he says of the swell of the Yes vote and the SNP surge. “Of course you know what’s going on, but you’re not in it and you’re not getting it day by day. Myself, my father and my grandfather were Labour voters all our lives and that’s a hard thing to get used to now. I wouldn’t want to say too much about it because I think enough has been said about it already, and I’m certainly not a politician. But it’s curious, what’s happening.”

I push him a bit further on the subject, putting forward the argument that perhaps the basic things people are looking for in politics in Scotland – social responsibility, a sense of community – have remained the same while the parties have changed their stances.

“I would agree with that,” he concedes. “That’s the one thing I would say: that it’s about trying to find these roots of the socialism which is in all our blood. That’s very important to us. If that’s what it’s about, then I’m all for it. I think it’s a wider issue than what seems to be simply independence or not.”

So says this veteran of politically conscious cinema, now fairytale anti-hero for a younger generation. But if the Scotland that Carlyle returns to in a few years’ time looks different to him on the surface, a lot of what he recognises will remain underneath. And that’s something he could really get to grips with, either in front of or behind a movie camera.

The Legend Of Barney Thomson is in cinemas from Friday