Hey @Thiago.Crepaldi
TorchScript integration with RPC is still experimental, and we are working on closing the gaps. Currently, in v1.5, applications can run TorchScript functions using RPC, e.g., rpc_sync/rpc_async/remote(to, my_script_func, args=(...)). But, within a script function only rpc_async can be called. See the test below:

  
      github.com
  
  
    pytorch/pytorch/blob/dad552666e1aaff174b549a38fce24b517c53d21/torch/testing/_internal/distributed/rpc/jit/rpc_test.py#L146-L154 2

@torch.jit.script
def call_rpc_with_profiling(handle: Tensor, dst_worker_name: str) -> Tensor:
    # Call rpc_async from within ScriptFunction and ensure that we can attach
    # profiling callbacks. Note that handle here is a Tensor representation of
    # RecordFunction.
    fut = rpc.rpc_async(dst_worker_name, one_arg, (torch.tensor(1),))
    torch.ops.profiler._call_end_callbacks_on_jit_fut(handle, fut)
    ret = fut.wait()
    return ret



  
  
    
    
  
  


Could you please try if using rpc_async works for you?
The issue below is tracking the progress on adding native RemoteModule support. Please feel free to comment there.

  
      github.com/pytorch/pytorch
  
  
    
  
	  
  

  
    
      [Design][RFC] RemoteModule API Design 2
    

    
      
        opened 
        
          
        
        Apr 23, 2020
      
      


      
        
          
          xush6528
        
      
    
  



  [Design][RFC] RemoteModule API Design
FB internal link, [Design] RemoteModule
Goal
Provide a wrapper nn.Module API that serves these purposes
Users should feel like using remote...



    jit
    module: rpc
    triaged