Hello. Welcome to Just Answer.
This is due to either a loose connection, or a switch that is failing.
It's not something to be overly worried about.
While the lights are working, the problem will be very difficult to troubleshoot.
Ideally, you actually need them to go off again, so you (with my help) or an electrician can begin tracing the wiring.
how urgently do I need to call some out or should I just wait and see if it happens again ,could it be dangerous
It's not dangerous. It will most likely just stop working altogether at some point. That actually makes it easier to troubleshoot.
it was all the upstairs lights ,not just one and i noticed the light in the in built smoke alarm went off aswell ,so is it ok to wait
Thank you for the additional information. That rules out a switch. It's in a junction box ahead of multiple switches. Since there is a smoke detector involved, I would have it repaired soon.
is it safe to wait a week to repair
Yes, if you have other smoke detectors.
You may want to consider a battery unit placed temporarily in the area of the disabled unit.
thanks for you help
You are most welcome. Is there anything else I can do for you at this time?