“We always wanted to do it,” Greg Berlanti, executive producer on both The CW’s “The Flash” and CBS’ “Supergirl,” told reporters at a recent press event. “From the day we cast Melissa [Benoist], the notion of her in scenes with Grant — or, someday maybe in the best of all worlds, with [‘Arrow’ star] Stephen [Amell] as well — it’s exciting to think of them on screen together. There was a similar tonality to the shows.”

Berlanti has been at the center of “Flash”/”Supergirl” crossover speculation from the beginning. Last May — months before “Supergirl” debuted on CBS — Gustin and Benoist appeared in costume on the cover of Variety, alongside Berlanti, planting the idea of a meeting of the two live-action superheroes in fans’ minds.

Even though it seemed like a natural fit — both heroes are just so darn likeable and good-natured — for a while it looked like the shows might be unable to bridge the network gap, but the episode — titled “Worlds Finest,” a shout-out to the classic DC team-up comic — was made official earlier this year. Yet it wasn’t just network logistics that needs to work out — the creative reasons had to be there, too.

“A few things definitely had to go right,” Berlanti said, adding at one point they considered holding off on a crossover until the second season of “Supergirl.” “We were introducing this notion of Earth-2 and the Multiverse [on the second season of ‘The Flash’], that had to work. We always said very openly that ‘Flash’ and ‘Arrow’ exist in a universe where there’s no Superman, or you would have heard about him. There was just the notion that it was two separate networks, so it was definitely more challenging in that way. Two separate cities that they shoot in. We wanted [‘Supergirl’] to work, stand on its own, have its own audience.”

Another key component in making #SupergirlXTheFlash, as it’s known on social media, happen? It had to matter for both characters, rather than being a hoax, dream or imaginary story.

“It [isn’t] just a gimmick episode,” Andrew Kreisberg, also an executive producer on both shows, said. “If you’re watching ‘Supergirl,’ she really needed [Flash] this week, because of the things that she’s been dealing with. She’s had a crisis of conscience because of the Red Kryptonite episode.”

“I always think back to ‘Hush,’ from ‘Buffy,'” Kreisberg continued. “On its own, it’s, ‘Oh, that’s the one where nobody could speak.’ But it was more than that. It was because it was an episode that started where everybody was having trouble communicating, and then suddenly their means of communication was taken away from them.”

As such, you’ll see references to the crossover on Tuesday’s episode of “The Flash,” even though it airs somewhat out of order due to the realities of network scheduling.

“They kind of flip order, obviously,” Berlanti explained. “The ‘Flash’ that sort of hints at how he gets over there and gets back airs on Tuesday. The audience has to forgive us that one is actually going to air before the crossover — and they shouldn’t wait to watch ‘Supergirl’ until after the ‘Flash’ episode!”

Of course, there’s another major DC Comics-based TV empire — Stephen Amell’s Green Arrow. Berlanti told the press that in a “perfect world,” he’d be involved in the crossover as well, but given that all shows were in crunch time leading to their respective season finales, it wasn’t possible.

“For me, [The Flash] was the door, the gateway,” Berlanti said. “He was the only one who had the capacity to really open that door, and hopefully now it’s open. In a perfect world, it probably would have been both of them — it’s not just ‘The Flash,’ it’s ‘Arrow,’ too. But logistically that would have been a nightmare at this point in the year to try and do it to both shows.”

Also, as Kreisberg pointed out, while the past “Flash” and “Arrow” crossover episodes are about the differences between the two title characters, a big part of the fun of tonight’s “Supergirl” is exploring Barry and Kara’s similarities.

“Creatively, with ‘The Flash’ and ‘Arrow’ crossovers, they’ve always been designed to highlight the heroes differences,” Kreisberg added. “There tended to be a great deal of conflict — a cross-cutting of styles. What was appealing about this was the idea of, Melissa and Grant are so similar as actors, and Barry and Kara both have a light to them. They’re definitely daytime heroes that live more in the light. Watching the two of them form this instantaneous best friendship was part of, creatively speaking, what was really exciting for us to explore in this episode.”

With two heroes come two villains — Silver Banshee, played by Italia Ricci, and Brit Morgan as the returning Livewire. Though tonight’s episode is the proper debut of Silver Banshee as a villain, Ricci has appeared in several past “Supergirl” episodes in her civilian identity, Siobhan Smythe.

“We’ve been setting up Silver Banshee for a bunch of episodes,” Kreisberg said. “Our shows tend to be so much about the heroes, and the heroes’ internal lives, that the villains tend to get short shrift. It was a real opportunity for us to introduce a character and have them stay on the show for a while, and really kind of get to know them and maybe even like them a little bit, so when they did transform, it actually meant something, as opposed to just the crazy thing that happens at the end of Act One.”

As if Livewire and Silver Banshee weren’t enough, the show’s producers originally envisioned a trio of villains for the episode.

“For our money, we thought Livewire was one of our most successful villains from early on,” Kreisberg said. “We were very much interested in bringing her back. If you’re going to have two heroes, you’re going to want to have multiple villains. An early version of the story actually had Bizarro teaming up with them as well, but it proved to be financially irresponsible.”

As to the future of Supergirl/Flash crossovers, the executive producers made it clear nothing further is planned — yet.

“We’re excited by this,” Berlanti said. “I think we want to wait and see the audience reaction to something like this. Just as storytellers and fans of the actors, we love it when we can figure out a way creatively to do it. Hopefully everybody enjoys it.”

While there’s now a proven doorway between “The Flash” and “Supergirl,” there’s a time-traveling spaceship on “DC’s Legends of Tomorrow” — which is evidently at least theoretically capable of reaching Supergirl’s universe, according to Kreisberg’s answer to a reporter’s question.