I am calling RunPython in VBA from the xlwings module with the following code:
Sub Portfolio_Optimze()
RunPython ("import quotes; quotes.get_quote()")
SolverAdd CellRef:="$H$18:$H$24", Relation:=1, FormulaText:="$J$18:$J$24"
SolverAdd CellRef:="$B$15:$G$15", Relation:=4
SolverOk SetCell:="$H$16", MaxMinVal:=1, ValueOf:=0, ByChange:="$B$15:$G$15", _
Engine:=1, EngineDesc:=" GRG Nonlinear "
SolverSolve
How do i make the SolverAdd code wait until the RunPython code is completely finished?
DoEvents(will let OS finish running tasks) andApplication.Wait()(will pause the execution). Because I'm not sure that you can get a return from your Python code to Loop on it while it isn't done