Whatever combination of passion, narcissism and bravery swirl to form an actor’s decision to tackle Hamlet must merit a spot in the Diagnostic and Statistical Manual of Mental Disorders. Short of that, we’ll have to rely on the wondrous Janet McTeer’s star turn in Theresa Rebeck’s spirited, funny new play Bernhardt/Hamlet to guide us up theater’s Mount Everest.

Opening tonight at the Roundabout Theatre Company’s American Airlines Theatre, Bernhardt/Hamlet is based on a real-life chapter in the life of legendary stage actress Sarah Bernhardt. Rebeck’s play – by turns comedy and drama – goes backstage as “the Divine Sarah” rehearses for her scandalous, much-anticipated debut as the Dane.

Weary of coasting along in one lucrative revival of Camille after another, the 55-year-old Bernhardt is risking her career, her reputation and her feeble bank account to pull up her pants and go, literally, for broke.

“Hamlet is Shakespeare himself, you know he is,” she tells her doubting, married lover, the playwright Edmond Rostand (Jason Butler Harner). “It is why every actor hungers after him, finally…”

(And let’s not smirk at the notion that jumping gender lines could rouse such ferocity. Ghostbusters 2016?)

The first half of Bernhardt/Hamlet mostly follows the actress and her co-stars as they rehearse, with Bernhardt defending her decision even as she panics over the enormous challenge. Rebeck is a playwright as prolific as she is divisive – critics have been arguing over the merits of her work for 20-plus years – and she draws a portrait of backstage camaraderie, artistic anxiety and 19th Century celebrity that’s both convincing and charming.

Running alongside all the backstage drama is Bernhardt’s romantic entanglement with the lovesick, creatively tortured Rostand, who against his better judgment gives in to Bernhardt’s request that he trim and rewrite the greatest drama in history. (Both Harner and Dylan Baker, as Bernhardt’s ever loyal co-star, hold their own on this beautifully designed set, no small feat with McTeer.)

And here Rebeck and director Moritz von Stuelpnagel might well have taken Bernhardt’s advice themselves. As Bernhardt/Hamlet widens its scope to examine the very nature of art itself, pitting actor against playwright, performer against critic, truth against commerce, things get talky. Very talky. There are witticisms galore – A woman who cannot do anything is nothing. A man who does nothing is Hamlet – and a good amount of genuine laughs, but points are made and remade past any need to convince.

Rebeck is too good at her craft, though, to let the play slip away. An Act II surprise – it shouldn’t be, but it is – introduces another strand of theatrical history, bringing plots together, refocusing ideas into new shapes and, finally, pointing to a new world fast approaching.