Imported functions missing arguments

I have some Python code with two classes - PyMaha() and MixerCL() - that I’m using in a Touch project. I’m getting the text into Touch via a filein DAT named “pymaha”, and then in a chop execute DAT I have the line from pymaha import MixerCL as cl

All of that seems to be fine, but when I call functions I’m getting an error that I’m missing a required positional argument. Here’s one of the functions as defined in the class MixerCL()

def setChanOn( self , chan , on ):
     self.chan = str(chan)
     self.on = str(on)

     command = ("string command {} 0 {}".format(self.chan , self.on)).encode()

#the following function is defined in PyMaha()
#PyMaha() is imported into MixerCL() in the __init__ function as

in the chop execute DAT in the onValueChange() function I simply have the following

cl.setChanOn( channel , val )

This returns an error telling me I’m missing the required positional argument “on”

I thought I would avoid all the weirdness of extensions and be able to write a single big of source code for use within and outside of Touch, that’s why I’m trying this import method, but clearly I’m missing something here.

If cl is a class definition, you need to create an instance of the class to use it. You can’t call a function on the definition like this.

got it. seems that import line I had doesn’t actually do what I thought it would.

I replaced it with the following, and now it’s all working. thanks!

import pymaha
cl = pymaha.MixerCL()