# Issue with loading multiple python script in UiPath

**URL:** <https://forum.uipath.com/t/issue-with-loading-multiple-python-script-in-uipath/151598>\
**Category:** Help\
**Tags:** python, activities\
**Created:** [September 18, 2019, 3:13am UTC](https://forum.uipath.com/t/issue-with-loading-multiple-python-script-in-uipath/151598 "2019-09-18T03:13:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![jothyprasanth.m](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jothyprasanth.m/32/2737_2.png) [@jothyprasanth.m](https://forum.uipath.com/u/jothyprasanth.m)\
**Post date:** [September 18, 2019, 3:13am UTC](https://forum.uipath.com/t/issue-with-loading-multiple-python-script-in-uipath/151598/1 "2019-09-18T03:13:52Z")

</div>

Hello All,

I have python project with more than one script, So I’m importing the sub-scripts and using it in the main script. When I run the python project from UiPath it’s throwing an error.

My question is How can I load the multiple python scripts in UiPath? Or How to import the required script in the main script file?

I attached the python script for your reference.  
In **Python\_Dic.py** I initialize dictionary value, I am calling **updateValue.py** from **Python\_Dic.py** and update the JSON value in **updateValue.py** and returning to **Python\_Dic.py**.  
When I run this from UiPath it’s showing the below error.  
**Note: When I ran this script from command prompt it was working fine**  
[Python Script.zip](https://forum.uipath.com/uploads/short-url/c8RuntNz3kUhVB6d2rpDfiVUW0p.zip) (572 Bytes)

_18.4.5+Branch.support/v2018.4.Sha.2a53a262e2c1098055c3ecbdabe73d45e0a6dc29_

_Source: Load Python Script_

_Message: Error loading Python script_

_Exception Type: System.InvalidOperationException_

_An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:_  
_System.InvalidOperationException: Error loading Python script ----\> System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: ModuleNotFoundError : No module named ‘idc’_

_Server stack trace:_  
_at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)_  
_at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)_  
_at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object ins, Object outs, TimeSpan timeout)_  
_at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)_  
_at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)_

_Exception rethrown at [0]:_  
_at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)_  
_at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)_  
_at UiPath.Python.Service.IPythonService.LoadScript(String code)_  
_at UiPath.Python.Impl.OutOfProcessEngine.\<\>c\_\_DisplayClass11\_0.b\_\_0()_  
_at System.Threading.Tasks.Task`1.InnerInvoke()_  
_at System.Threading.Tasks.Task.Execute()_  
_— End of stack trace from previous location where exception was thrown —_  
_at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)_  
_at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)_  
_at UiPath.Python.Activities.LoadScript.d\_\_12.MoveNext()_  
_— End of inner ExceptionDetail stack trace —_  
_at UiPath.Python.Activities.LoadScript.d\_\_12.MoveNext()_  
_— End of stack trace from previous location where exception was thrown —_  
_at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)_  
_at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)_  
_at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)_

Looking for reply

Regards  
**JothyPrasanth M**

---

<div class="post-metadata">

**Author:** ![HareeshMR](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/hareeshmr/32/181825_2.png) [@HareeshMR](https://forum.uipath.com/u/HareeshMR)\
**Post date:** [September 18, 2019, 9:24am UTC](https://forum.uipath.com/t/issue-with-loading-multiple-python-script-in-uipath/151598/2 "2019-09-18T09:24:25Z")

</div>

> [@jothyprasanth.m](#):
>
> ModuleNotFoundError : No module named ‘idc’

The error is not about the multiple scripts, it is not recognizing the module @jothyprasanth.m

Can you please check if it working fine when you run the code manually? And

one more thing is, you can load any number of scripts using load pythn scripts and store the loaded scripts in different variables. After that you can use the required code at required positions of the workflow

---

<div class="post-metadata">

**Author:** ![jothyprasanth.m](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jothyprasanth.m/32/2737_2.png) [@jothyprasanth.m](https://forum.uipath.com/u/jothyprasanth.m)\
**Post date:** [September 19, 2019, 1:30am UTC](https://forum.uipath.com/t/issue-with-loading-multiple-python-script-in-uipath/151598/3 "2019-09-19T01:30:21Z")

</div>

Hi @HareeshMR

It was working fine when I run it manually  
If I load more then one script which instance I need to **Invoke Method** (Python Activity)?

Thanks  
**JothyPrasanth M**

---

<div class="post-metadata">

**Author:** ![HareeshMR](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/hareeshmr/32/181825_2.png) [@HareeshMR](https://forum.uipath.com/u/HareeshMR)\
**Post date:** [September 19, 2019, 5:59am UTC](https://forum.uipath.com/t/issue-with-loading-multiple-python-script-in-uipath/151598/4 "2019-09-19T05:59:33Z")

</div>

I mean, if you load all scripts into different variables , say py1, py2 and py3, then if you have three different methods in three scripts, whatever function you want to pass the parameters, provide that script variable in load python method @jothyprasanth.m

---

<div class="post-metadata">

**Author:** ![jothyprasanth.m](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jothyprasanth.m/32/2737_2.png) [@jothyprasanth.m](https://forum.uipath.com/u/jothyprasanth.m)\
**Post date:** [September 19, 2019, 6:31am UTC](https://forum.uipath.com/t/issue-with-loading-multiple-python-script-in-uipath/151598/5 "2019-09-19T06:31:04Z")

</div>

HI @HareeshMR  
Let’s have some example

**Python.Dic.py**  
from updateValue import updateFunc  
json\_str= ‘{“name”:“jothyprasanth”,“company”:“xxxx”}’  
print(json\_str)  
def foo(dictArg):  
outJson = updateFunc(dictArg) **#Calling function**  
print(outJson)  
return outJson

**updateValue.py**  
import json  
def updateFunc(dictArg):  
jsonTodict = json.loads(dictArg)  
jsonTodict[‘name’] = “JOTHYPRASANTH”  
jsonTodict[‘company’] = “yyyyy”  
outJson = json.dumps(jsonTodict)  
print(outJson)  
return outJson

In this example, the want to invoke function **foo** is under **Python\_Dic.py** script, so I am loading the python\_Dic.py script in uipath and using that instance in invoking method. The problem is inside the foo function I am invoking another function called updateFunc that is not identified in uipath and it’s throwing an error. The updateFunc is in different script.

**Error from UiPath:**  
18.4.5+Branch.support/v2018.4.Sha.2a53a262e2c1098055c3ecbdabe73d45e0a6dc29

Source: Load Python Script

Message: Error loading Python script

Exception Type: System.InvalidOperationException

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:  
System.InvalidOperationException: Error loading Python script ----\> System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: ModuleNotFoundError : No module named ‘updateValue’

Server stack trace:  
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)  
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)  
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object ins, Object outs, TimeSpan timeout)  
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)  
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:  
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)  
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)  
at UiPath.Python.Service.IPythonService.LoadScript(String code)  
at UiPath.Python.Impl.OutOfProcessEngine.\<\>c\_\_DisplayClass11\_0.b\_\_0()  
at System.Threading.Tasks.Task`1.InnerInvoke()  
at System.Threading.Tasks.Task.Execute()  
— End of stack trace from previous location where exception was thrown —  
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)  
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)  
at UiPath.Python.Activities.LoadScript.d\_\_12.MoveNext()  
— End of inner ExceptionDetail stack trace —  
at UiPath.Python.Activities.LoadScript.d\_\_12.MoveNext()  
— End of stack trace from previous location where exception was thrown —  
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)  
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)  
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Hope now it’s clear.

Cheers,  
**JothyPrasanth M**

---

<div class="post-metadata">

**Author:** ![HareeshMR](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/hareeshmr/32/181825_2.png) [@HareeshMR](https://forum.uipath.com/u/HareeshMR)\
**Post date:** [September 19, 2019, 6:34am UTC](https://forum.uipath.com/t/issue-with-loading-multiple-python-script-in-uipath/151598/6 "2019-09-19T06:34:52Z")

</div>

Heyy @jothyprasanth.m,

I got it now, you are using inheritance concept here, I don’t think it is possible in uipath, why don’t you place both the functions in a same file and call within it

---

<div class="post-metadata">

**Author:** ![jothyprasanth.m](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jothyprasanth.m/32/2737_2.png) [@jothyprasanth.m](https://forum.uipath.com/u/jothyprasanth.m)\
**Post date:** [September 19, 2019, 6:48am UTC](https://forum.uipath.com/t/issue-with-loading-multiple-python-script-in-uipath/151598/7 "2019-09-19T06:48:34Z")

</div>

Hi @HareeshMR

This is just for an example, What if I have large python project that need to run from UiPath can’t keep all the function in the same file.  
That’s why I want know

Anyway thanks for your response

Cheers,  
**JothyPrasanth M**

---

<div class="post-metadata">

**Author:** ![HareeshMR](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/hareeshmr/32/181825_2.png) [@HareeshMR](https://forum.uipath.com/u/HareeshMR)\
**Post date:** [September 19, 2019, 6:50am UTC](https://forum.uipath.com/t/issue-with-loading-multiple-python-script-in-uipath/151598/8 "2019-09-19T06:50:22Z")

</div>

Yeah I understand that, As we have option to load a jar file in such scenarios, you can go with that. but if you are particular with python, I don’t find any option.

---

<div class="post-metadata">

**Author:** ![asgRPA](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/asgrpa/32/176627_2.png) [@asgRPA](https://forum.uipath.com/u/asgRPA)\
**Post date:** [July 28, 2020, 9:25am UTC](https://forum.uipath.com/t/issue-with-loading-multiple-python-script-in-uipath/151598/9 "2020-07-28T09:25:27Z")

</div>

I had the same problem and what I did to overcome this issue was just simply calling my main.py script from the CMD by using a Start process activity and then a Type activity.

Another solution I came up was creating a few lines of [VB.NET](http://VB.NET) into an invoke code activity from where I opened the CMD and called the script of python.

Hope you find this useful!
