Currently i'm struggeling with writing IronPython modules in c#. At first i have some empty partial class, which represents the module base:
[assembly: PythonModule("demo", typeof(Demo.IronPythonAPI.PythonAPIModule))]
namespace Demo.IronPythonAPI
{
/// <summary>
/// Demo api module root/base
/// </summary>
public static partial class PythonAPIModule
{
}
}
In some other files, i try to implement the modules:
namespace Demo.IronPythonAPI
{
/// <summary>
/// Python api module path root (~import demo)
/// </summary>
public static partial class PythonAPIModule
{
/// <summary>
/// Python SQL-Module
/// </summary>
[PythonType]
public static class Sql
{
public static int executeNoneQuery(string query, string conName)
{
Console.WriteLine("Hello World");
return 0;
}
}
}
}
If i now want to use the module, it does not work:
import demo
Sql.executeNoneQuery("", "")
This throws the exception:
name 'Sql' is not defined
When using
from demo import Sql
Sql.executeNoneQuery("", "")
Everything works just fine. What did i do actualy wrong?
Thank you very much!