[WIP] Add ability to create module from C# by slide · Pull Request #1447 · pythonnet/pythonnet

What does this implement/fix? Explain your changes.

This allows doing something like this, which I haven't found any other way to do:

var mod = PythonEngine.AddModule("mymod");
var myobj = new object();
mod.SetAttr("myprop".ToPython(), myobj.ToPython());
import mymod
print(mymod.myprop)

This is very useful for providing objects to an embedded Python engine.

Does this close any currently open issues?

I could not find any specific issues that would be related.

Any other comments?

This is an initial PR to get feedback if this would be allowed, I have a build of the library locally with this change and use this in my code, but would like to have it upstream if possible. I will fill out the remaining details and add tests if folks think this would be ok.

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Add yourself to AUTHORS
  • Updated the CHANGELOG