Microbot working in seperate process but not working when integrated with main process

We have created a MB in vs2019 .net framework 4.6.1 for AE Studio 18.1(licensed). After creating the microbot, the bot is running and giving output in a seperate process. But when we try to integrate into any process or reuse the microbot seperate process, it is failing and giving “Object reference not set to instance of an object”. All input and output parameters were mapped correctly for the microbot. Please help on the issue.