Function scripted by jit.export in с++

Hello. I scripted by torch.jit.export function init_state() but can’t use it in c++ code.

Example:
class my_class(torch.nn.Module):
def forward …

@torch.jit.export
def init_state():
       pass

a = torch.jit.script(my_class)
a.init_state(). #is working
a.save(‘test.pt’)

In c++:
auto b =torch:jit:load(“test.pt”);
b.init_state(); //error

‘Struct torch:jit:Module’ has no member "init-state’’
Please help me use init_state in c++.

Works, without () in the end. Thank you very much)))

Thank you. I understand. My class and function are more complicate than i show, i can’t run program, but it compiles with run_method and with get_method without (). I see now, that init_state not need jit.export in my case(forward use init_state)
get_method with () //error
no match for call to ‘(torch::jit::method)()’

Thank you. It is working! Excellent)