Both par and de are quite accepted, and I can’t see any reason or context why you couldn’t use one or the other, as long as we are talking about a theater/poetry work, since it bears a bit of a “classical” and old-fashioned connotation.
For any other artistic production (novels, song, painting, movie, etc…) I would tend to use de.
« de » is probably the form you’re searching for.
« par » is far less common in this context, it’s mostly used for adaptations (a movie adapted from a book, for example) or interpretations (musical or theatrical performance, …).
But I guess it would be understood anyway, and cannot actually be said “incorrect”.
The preposition is de when the book or other work is not mentioned by name.
un livre de Balzac
cette chanson de Renaud
le premier film de Renoir
The preposition is par when the origin of the work is expressed by a verb in the passive voice.
un livre écrit par Balzac
cette chanson composée par Renaud
le premier film tourné par Renoir
When the title is mentioned, it is common that two interpretations are possible: a work “of” (i.e. by) an author; or a work written (or composed, etc.) by the author, where the verb is omitted.
Le Colonel Chabert de Balzac or Le Colonel Chabert, par Balzac
Déserteur de Renaud or Déserteur, par Renaud
La Fille de l’eau de Renoir or La Fille de l’eau, par Renoir
There can be exceptions, but usually, when the title and the author form a noun phrase, de is used. The preposition par is used when the author indication is a subtitle to the title (it’s what you’d put on a book cover, if you put a preposition at all) or a parenthetical remark.
Le Colonel Chabert, par Balzac, est un hommage aux soldats de Napoléon.
Je lis Le Colonel Chabert de Balzac.
For works that have multiple authors, such as films and songs, the preposition par is rarely used unless the role of the authors is explicited (un film de Renoir vs. un film réalisé par Renoir).