0

How to call setValues function outside the class?

Class is defined as below:

class CallbackDataBlock(ModbusSparseDataBlock):

   def setValues(self, address, value):
       super(CallbackDataBlock, self).setValues(address, value)
       self.queue.put((self.devices.get(address, None), value))
1
  • 2
    That function is a method. Create an instance of the class, say c, then call it like c.setValues(...) Commented Jan 7, 2019 at 11:30

1 Answer 1

4

if you have an object (let's call it my_object) of class CallbackDataBlock you should be able to call it like this:

my_object = CallbackDataBlock()
my_object.setValues(myaddress, myvalue)

just make sure you put in correct address and value in the arguments.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.