Hello
I have 4 .py files along with __init__.py in a folder.
I want to create a file which would act as a menu and load classes from the files in that folder.
I have that file outside the folder.
The contents of that file:
from files import *
print "CPU Scheduling Algorithm Simulation\n"
print "Which Algorithm do you want to run? "
print "1.FCFS\n2.SJF\n3.Priority Scheduling\n4.Round Robin Scheduling\n"
choice=input()
if choice==1:
fc=FCFS()
fc
elif choice==3:
pr=Priori
pr
elif choice==2:
import sjf #as this file does not have a class
elif choice==4:
ro=RRobin()
ro
else:
print "Wrong choice"
raw_input()
So the folder structure is like this:
CPUSh.py
files [ this is a folder]
|
->__init__.py
->fcfs.py
->priority.py
-> sjf.py
->rr.py
each .py files mentioned above has all the code and functions inside single class(which I am instantiating in the CPUSh.py file)
So how do I make it in such a way that when I enter a particular choice the corresponding file executes?
Thank you