Using python with the BOI

SOLVED

We have a python (3.10) application that we want to use to create a sales order in Sage 100.

I have installed pywin32 so the python script can access win32/COM.

This code works up to the point where I try to call a method on the SY_Session object:

import win32com.client as win32
oScript = win32.dynamic.Dispatch("ProvideX.Script") #dynamic = late binding
print( oScript.State )
print( oScript.Instance ) 
oScript.Init("C:\Sage100_v2021\MAS90\Home")
print( oScript.State ) 
oSS = oScript.NewObject("SY_Session") 
r = oSS.nLogon() 

As expected the code outputs the following:

0
{A587B8B2-210E-4BF7-BC88-427744952D5F}
1

but when it tries to call the nLogon method on the session object it throws an error:

TypeError: 'int' object is not callable

The same program as VBS runs successfully on the workstation:

Set oScript = CreateObject ("ProvideX.Script")
MsgBox oScript.State
oScript.Init("C:\Sage100_v2021\MAS90\Home")
MsgBox oScript.State
Set oSS = oScript.NewObject("SY_Session")
retVal = oSS.nLogon()
If retVal=0 Then
	retVal = oss.nSetUser("craig","password") 
End If
MsgBox oSS.sUserName

Has anyone had any success using python and the BOI?