Provide C#'s namespace from IronPython
Question: I want to write Tomboy add-on using IronPython and I'm stuck and very
beginning -- I need to provide C#'s namespace.

I mean, here's howto in writing Tomboy add-on's
<http://live.gnome.org/Tomboy/HowToCreateAddins>

> Let's start with creating the plugin file called InsertDateTime.cs with the
> following content:
>  
>  
>     using Tomboy;
>  
>     namespace Tomboy.InsertDateTime
>     {
>             public class InsertDateTimeAddin : NoteAddin
>             {
>                     public override void Initialize ()
>                     {
>                     }
>  
>                     public override void Shutdown ()
>                     {
>                     }
>  
>                     public override void OnNoteOpened ()
>                     {
>                     }
>             }
>     }
>  

Can I do that with IronPython? Thank you.


Answer: From Python you can import the clr module and then call
clr.AddReference('AssemblyName') where assembly name is a partial or full
assembly name - maybe in your case it's Tomboy, it's whatever you'd compile
against with C#. Then you can do "import Tomboy" or "from Tomboy import
NoteAddin".

If you're hosting IronPython via the hosting APIs you can instead do
scriptRuntime.LoadAssembly(typeof(NoetAddin).Assembly); so that you don't have
to do it in Python. That can be particularly useful to avoid various loader
context issues depending on how the assembly gets loaded.

