0

I made a process scheduler simulator. I gave each scheduling algorithm its' own class within its' own file. all within a folder called Schedulers. In order to use them I have to import them like this:

from Schedulers.SchedulerFCFS import SchedulerFCFS
from Schedulers.SchedulerSJF import SchedulerSJF
from Schedulers.SchedulerRR import SchedulerRR

Anytime I add a new Scheduler class I'd have to add it to the imports. Is there a better way to import all of these classes?

DNS_Jeezus
  • 231
  • 2
  • 13

1 Answers1

-1

You could import all the classes by using from (YourPackage) import *.

For your example:

from Schedulers.SchedulerFCFS import *
from Schedulers.SchedulerSJF import *
from Schedulers.SchedulerRR import *

For more information you could read this article: https://medium.com/@s16h/importing-star-in-python-88fe9e8bd4d2

Bob Stone
  • 78
  • 1
  • 12