In “A Discovery of Witches,” USC history professor Deborah Harkness’ debut novel, a young scholar finds a lost medieval manuscript, opening the door to supernatural stirrings and to her own witchy past.

Harkness will be at Warwick’s Thursday at 7:30 p.m. She answered questions recently by e-mail.

Where did the idea for this book come from, and how long have you been working on it?

In some ways I’ve been reading and researching this book since I was an undergraduate at Mt. Holyoke College. Way back then, I took a course that explored the relationship between magic and science. I’ve been fascinated ever since by how people in the past imagined the world and their place in it.

What were some of the challenges for you, as a scholar, to write fiction?

I had an enormous amount of fun writing the book. Nevertheless, writing is never easy. What I discovered when writing fiction is that the characters are always doing something you never imagine they would do!

You sprinkle real history throughout the book, starting with the title. What is the connection to Salem?

“A Discovery of Witches” is based on a book written by the English “witchfinder general” Matthew Hopkins, “The Discovery of Witches” (1647). I love the title because discovery can mean finding something unexpected, or it can mean peeling back layers of secrets. The Salem connection is in (protagonist Diana Bishop’s) last name and family history — she is descended from some of those accused of being witches in 1692.

Other favorite historical details you’ve tucked into the story?

There are all kinds of historical and literary nuggets in the book. Ashmole 782, the mysterious Bodleian Library manuscript at the center of “A Discovery of Witches” is a real manuscript — and it’s really missing.

Domenico Michele, (a villain in the book), was a real person. He was the 35th Doge of Venice and governed there during the 12th Century. And I enjoy playing with the meaning of names, so you can look up any of the characters’ names and find out something about them.

The book hinges on the discovery of a lost manuscript, and I understand you had a similar experience as a young scholar. Please explain?

Once upon a time, I was doing research at the Bodleian Library and I found a lost magical manuscript that had belonged to Queen Elizabeth I’s court astrologer. People had been looking for it for some time, but I found it by accident. That’s the coolest thing that’s ever happened to me in a library, and it went straight into the novel.

How much of you is in Diana Bishop? (And how much of her do you wish was in you?)

All of the characters in “A Discovery of Witches” have some element of me in them. But Diana isn’t a carbon copy of anyone — me least of all. Instead, she exemplifies many of the characteristics I admire in others: intelligence, loyalty, fearlessness, and curiosity.

There’s great public fascination now with wizards, witches and vampires. Why do you think such stories are popular?