If this applies across-the-board to subjects, rather than just the subjects that you find boring or poorly-taught, you may have one of the attention-deficit disorders in your brain wiring and may be a candidate for medication.
If you can stay focused on working problems, or on ordinary play, that's great. "Focus formula
" concoctions from health-food stores are health frauds. Best wishes.