I have a mathematical model with the .mod ("trial.mod") extension and data file with the extension of .dat on cplex; I want to import this model and the initial solution of it to the python to develop a sort of improvement heuristic which is based on the initial solution.
To do that, I applied
main { 
thisOplModel.generate(); 
cplex.exportModel("trial.lp")
}
at the end of the .mod file. My Python code is:
import cplex
import sys
def  sample(filename):
    c = cplex.Cplex("trial.lp")
    try:
        c.solve()
    except CplexSolverError:
        print ("Exception raised during solve")
    return
    status = c.solution.get_status()
    print ("Solution status = " , status, ":",)
    print (c.solution.status[status])
    print ("Objective value = " , c.solution.get_objective_value())
When I run my Python code I am getting "No module called 'cplex' error.
What is my mistake, how can I correct my Python code to reach the aim?
I use Cplex 12.6