0

I have been trying to call a C# dll from python with no success. My C# class is:

namespace ClassLibrary1
{
    public class Class1
    {
        public double Add_It(double x1, double x2, double x3, double x4)
        {
            return x1 * x4 * (x1 + x2 + x3) + x3;
        }
     }
}

and Python code is:

import clr
clr.AddReference('C:/Users/MNCHR/Desktop/ClassLibrary1.dll')
from ClassLibrary1 import Class1

The error is

ImportError: cannot import name 'Class1'

please advise

4
  • Whats the full Namespace of Class1? Commented Jan 3, 2018 at 18:42
  • Duplicate of: stackoverflow.com/a/2077878/2147110 Commented Jan 3, 2018 at 18:44
  • As it can be seen in the C# code the namespace is ClassLibrary1 Commented Jan 3, 2018 at 19:12
  • I know my question might be a duplication but foe some reasons procedure suggested in similar posts does not work for me Commented Jan 3, 2018 at 19:14

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.