class Trainer():
     def __init__(self,param):
        ..........
        optimizer_target = getattr(optim, param['optimizer'])(net.parameters(), lr = param['learning_rate'])

     def train(epoch):
        .......... 

     def test(self, epoch):
        ..........

  def objective(self,train):
        params = {}

if __name__ == '__main__':
    study = optuna.create_study(direction="maximize")
    study.optimize(objective)


when I call this objective function in main() it gives me different errors.No matter if I call this function like this it gives me the error
study.optimize(lambda trial: Trainer.objective(trial))

If I design it without the class Trainer it gives me the error. Kindly suggest how to call the dictionary of objective class and calling objective function in main()
Error
study.optimize(lambda trial: Trainer.objective(trial))
TypeError: objective() missing 1 required positional argument: ‘trial’