views:

127

answers:

2

I'm adding a reference to a funciones.dll file using

clr.AddReferenceToFileAndPath() because I couldnt get it to work other way with this file and it succesfully does it. The file is named funciones.dll and it's in the bin folder. But when I do

from funciones import * 

I get "no module named funciones"

since the funciones.dll file it's a funciones.py file compiled, shouldnt the module name only be named funciones and no any other name? isnt the name the problem and it's another? I dont know what other info could be relevant here but if there is any let me know

+1  A: 

When doing the from x import * you need to put the namespace from the dll where x is.

So if you your code looks like

namespace Foo.Bar{
  //code in here
}

your ironpython code would look like

import clr
clr.AddReferenceFromFileAndPath("/path/to/dll.dll")
from Foo.Bar import *
AutomatedTester
Thanks, though I dont have a namespace explicity declared in the funciones.dll, which comes from a file in IronPython code (not C#). Besides if I do from funciones import * or import funciones I get the same (in the case if you meant doing otherwise it wouldnt be the same)
Pablo
A: 

Solved by compiling the .py file with clr.CompileModules() instead of pyc.py . The module can be imported when you compile it that way (Thanks Dino)

Pablo