TorchScript only supports PyTorch and the math module, so numpy functions won’t work natively and can’t be exported. You can use torch.jit.ignore as you have done to leave a call to the Python interpreter. Modifying your example slightly and running with the latest version of PyTorch:
@torch.jit.ignore
def call_np() -> int:
    return np.random.choice(2, p=[.95,.05])

class MyModule(nn.Module):
    def forward(self):
        pass

    @torch.jit.export
    def func(self):
        done = call_np()
        print (done)

scripted_module = torch.jit.script(MyModule())
print(scripted_module.func.graph)
scripted_module.func()

prints
graph(%self : __torch__.MyModule):
  %3 : None = prim::Constant() # ../test.py:184:4
  %done.1 : int = ^call_np()() # ../test.py:185:15
   = prim::Print(%done.1) # ../test.py:186:8
  return (%3)

0

In which we can see ^call_np() which is an upcall to Python. You must also type annotate call_np since all arguments / returns are assumed to be Tensors unless otherwise specified. torch.jit.export is also intended to be used only as a decorator on a function (see here for details 21).
I couldn’t repro your exact error, could you file an issue on GitHub 4 with a full repro to produce your issue? Even if what’s happening should throw an error the message could be made more clear. I also ran into this issue 5 while trying to repro it which seems like another bug.