You can't just pop Modafinil like sweeties and they are - certainly IMHO - prescribed medication and for certain medical conditions only. Should you have such a medical condition you should not be flying without having declared it to your company and declared to and agreed by your AME.