My grandmother, Hajja Susu, was a vociferous reader. Her book collection in our family’s Sudanese home was a sight to behold. The floor-to-ceiling bookshelves were inlaid into the walls of the lounge room, the book spines seeming almost structural, the very backbone of a house that sheltered generations. Making one’s way through the desert-dust-covered library was a rite of passage; how else would we learn to solve a murder mystery, identify the symptoms of gout, or perfect cross-stitch?

I became a bonafide expert in tropical diseases by thumbing through the thick tomes of the “Tell Me Why” series, memorising the treatment for malaria, tape worm and dengue fever “just in case”. Agatha Christie’s teachings on murder were second to none, and the poetry of studying her lessons in Sudan wasn’t lost on me. I read Death on the Nile on the banks of that very same river.

I even found myself studying a number of 1950s English housewife manuals on how to be the “perfect lady”, complete with my grandmother’s notes scrawled in tiny cursive in the margins. Imagine the deep disappointment when my favourite hobbies of rock collecting, woodwork and tree climbing were not listed as desirable “ladylike” activities. There seemed to be quite a lot of emphasis on cooking, cleaning and “pleasing your man”; it also seemed strange to me that all the illustrations were of white English women with tiny waists and straight hair.

Photograph: Penguin

Although my grandmother put her hair in rollers and wore the “right” kinds of skirts, we just weren’t built the same way. Still, always one for experimentation, I spent a couple of weeks sitting with my back straight as a rod, wearing dainty slippers and speaking softly. My days as a 50s-style housewife were, perhaps predictably, severely numbered.

I was barely a teenager when Hajja Susu visited from Sudan to spend a winter with my brother and me in our Brisbane home. Al-Hajja, an honorific earned after she had completed the Islamic pilgrimage to Mecca, flew across the Indian Ocean to look after us while our parents were away. Having read many of her books on trips back to Sudan, I wanted to return the favour and give her the opportunity to read some of mine, so I prepared for Al-Hajja’s arrival by artfully arranging a selection of my favourite books on the kitchen counter. This would be the perfect welcoming gift, I thought.

Perhaps it should not have been surprising that after a few days of going through my pile of suggested reading, Al-Hajja came to me, shaking her head. “Yassmina, don’t you have any normal books here?” she asked. I cocked my head, the beads on my braids noisily clattering against each other. “What do you mean?” I asked.

The characters I loved were often the outsiders, the outcasts, those ostracised from their societies

She sighed. “Everything here is dragons, knights, magic and chaos. Don’t you have anything with real people, doing real things? Anything at all? Mills and Boon, even?”

I hadn’t even heard of the Bills and Moon, I informed her sagely. Were they also murder mystery investigators?

While Tamora Pierce, JK Rowling, Ursula Le Guin, Brandon Sanderson and Robin Hobb might not have been to my grandmother’s liking, the role they played in my life was unrivalled. They, and many others, moulded my entire young adult world.

Yassmin Adbel-Magied: Photograph: Penguin

I wanted to be Alanna, from Tamora Pierce’s first series, a young woman who became a knight and one of the king’s favourite fighters. She eventually married a ruffian criminal who turned his back on a life of crime to be with her (um, yes!). Or perhaps I could learn to be like the teenage spy Alex Rider, a (very cute) British linguist with enviable karate skills. Or maybe I’d grow up to be like Nancy Drew, a girl who asked questions and solved mysteries the adults couldn’t figure out.

And anyway, that would all be while I waited, like every kid of my generation, for my invitation from Hogwarts. It was only a matter of time, no?

My grandmother could never understand why I loved these books full of dragons and danger so much. I would stay up well after bedtime, eyes straining in the dim light, to keep reading, to find out what happened next. I would lose myself in these worlds, but at the time I couldn’t really tell her why.

They were escapist books full of intrigue, insight and inspiration. But that’s not all they were, because they were also full of hardship and struggle, challenges that were personal, political and existential. Those stories nurtured my imagination and allowed me to think beyond the world I lived in. The characters I loved were often the outsiders, the outcasts, those ostracised from their societies. My favourites were the ones finding ways to build a family and community that would accept them. I suppose I was searching for a blueprint to do just the same.

I couldn’t be who I couldn’t see, but maybe I could be who I could read. Therein lies the power of fiction for younger readers, and it’s a power even my grandmother cannot deny.

• You Must Be Layla, a novel for children by Yassmin Abdel Magied, is out now through Penguin