Skip to content

Commit

Permalink
Improved exec api
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Aug 8, 2024
1 parent 6cc0cf7 commit c16acd0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/runtime/McNeel.PythonEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,20 @@ public void RunScript(string script)

public object CreateScope(string scopeName, string pythonFile) => PrepareScope(scopeName, pythonFile);

public void RunScope(object scope, string script)
{
PyModule pyscope = (PyModule)scope;

try
{
pyscope.Exec(script);
}
catch (PythonException pyEx)
{
throw new PyException(pyEx);
}
}

public void RunScope(
object scope,
object code,
Expand Down

0 comments on commit c16acd0

Please sign in to comment.