Stephen Jeffrey’s manual on how to write plays is brilliant. He had a celebrated series of workshops he used to do, although I never made it to one. The book covers character, form, structure and story in one of the most accessible, comprehensive and erudite fashion. Great for an enthusiastic beginner or seasoned writer alike.
One short passage “your characters do not necessarily understand their motivations, and that the gap between characters’ stated intentions and their deeper motivations is a very fruitful area for the playwright. Indeed, you may not fully understand your character yourself. During rehearsals for the second production of my play The Libertine, I asked John Malkovich, who was playing the Earl of Rochester, what he thought the play was actually about. He replied by saying that he thought Rochester was a man who had been given every conceivable physical and intellectual gift and had quite deliberately proceeded to waste them. On hearing this for the first time, I not only understood my play, but realised for the first time why I had written it. In a sense, the characters you write will never be entirely knowable, just as you will never entirely understand the people you meet in life..."
If you are interested in the structure of plays (and also film and some similarities/differences), I can recommend it.
Stephen Jeffrey’s Playwriting: Structure, Character, How and What to Write