[Python.NET] Accessing Public Functions in Module

Kyle Stevens kyle.stevens at thenortheastgroup.com
Tue Dec 18 21:02:29 CET 2007


We have an application that was developed in Visual Basic, and would 
like to use Python for .NET to extend it.  I've played around with it a 
bit, and everything works fine if it is within a class in the .Net assembly.

However, there are a number of components that exist as public functions 
within a module.  I cannot seem to access them from Python for .NET.

My latest session is shown below, where I try to import and use the 
function, "NonQuery" within the module, "SQL_Module" to no avail.

Thanks for any help, and thanks for this wonderful piece of software.  I 
can't wait to start programming some things with this instead of Visual 
Basic.

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

Z:\>\\buffalo02\share\IT\python\python\python.exe
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit 
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> import Nepco4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Nepco4
 >>> from NepcoV2 import Order
 >>> from NepcoV2 import NonQuery
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name NonQuery
 >>> from NepcoV2 import SQL_Module.NonQuery
  File "<stdin>", line 1
    from NepcoV2 import SQL_Module.NonQuery
                                  ^
SyntaxError: invalid syntax
 >>> from NepcoV2.SQL_Module import NonQuery
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named SQL_Module
 >>> import Nepco4.NepcoV2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Nepco4.NepcoV2
 >>> from Nepco4 import NepcoV2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Nepco4
 >>> from NepcoV2 import SQL_Module
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name SQL_Module
 >>> from NepcoV2 import SQL_Module5
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name SQL_Module5
 >>> from NepcoV2 import SQL_Modulf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name SQL_Modulf
 >>> from NepcoV2 import Shipping_Detail_Report
 >>> from NepcoV2 import *
 >>> NonQuery()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'NonQuery' is not defined
 >>> NepcoV2.NonQuery()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'NepcoV2' is not defined
 >>>


More information about the PythonDotNet mailing list