How to import static class (or static method) into IronPython (or DLR) using C# code(not python)?

2k views Asked by At

scope.SetVariable("math", ?? typeof(System.Math) ??);

or do I need create a module?

1

There are 1 answers

3
Dino Viehland On BEST ANSWER

You can do:

scope.SetVariable("math", DynamicHelpers.GetPythonTypeFromType(typeof(System.Math)));

DynamicHelpers is in IronPython.Runtime.Types.