# Python source file cannot be found

**URL:** <https://forum.uipath.com/t/python-source-file-cannot-be-found/105883>\
**Category:** Help\
**Tags:** python, activities\
**Created:** [March 28, 2019, 11:34am UTC](https://forum.uipath.com/t/python-source-file-cannot-be-found/105883 "2019-03-28T11:34:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tiramisu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/tiramisu/32/176627_2.png) [@Tiramisu](https://forum.uipath.com/u/Tiramisu)\
**Post date:** [March 28, 2019, 11:34am UTC](https://forum.uipath.com/t/python-source-file-cannot-be-found/105883/1 "2019-03-28T11:34:53Z")

</div>

#### Scenario:

“Load Python Script” activity has issues at runtime. The standard attribute ` __file__ ` is not being assigned.

#### Steps to reproduce:

Create Python scope. Load Python Script.  
script.py:

```auto
print(f" __file__ = { __file__ }")

```

#### Current Behavior:

Returns:  
` __file__ = none`

#### Expected Behavior:

` __file__ = C:\Users\username\UiPath\project_name\script.py`

#### Studio/Robot/Orchestrator Version:

Last stable behavior:  
N/A  
Last stable version:  
2018.4.5 Enterprise  
OS Version:  
Win10 Pro 64-Bit

Others if Relevant: (workflow, logs, .net version, service pack, etc):

Python 3.6.8 Anaconda Inc. 64-bit

---

<div class="post-metadata">

**Author:** ![loginerror](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/loginerror/32/22614_2.png) [@loginerror](https://forum.uipath.com/u/loginerror)\
**Post date:** [April 1, 2019, 7:20am UTC](https://forum.uipath.com/t/python-source-file-cannot-be-found/105883/2 "2019-04-01T07:20:14Z")

</div>

Hi @Tiramisu

Any chance you could provide a sample project? Feel free to simply create a new project and zip it’s entire folder for us to investigate 🙂  
That’s the quickest way for us to replicate the behavior.

Also, please keep in mind that some packages were “outsourced” to the community via our GitHub and Python activity pack is one of those:

> **[Community.Activities/Activities/Python at master · UiPath/Community.Activities](https://github.com/UiPath/Community.Activities/tree/master/Activities/Python)**
>
> master/Activities/Python

Therefore, you might want to log an issue over there or even contribute directly to fixing it 🙂

---

<div class="post-metadata">

**Author:** ![Tiramisu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/tiramisu/32/176627_2.png) [@Tiramisu](https://forum.uipath.com/u/Tiramisu)\
**Post date:** [April 1, 2019, 12:09pm UTC](https://forum.uipath.com/t/python-source-file-cannot-be-found/105883/3 "2019-04-01T12:09:16Z")

</div>

Following an existing thread here:

> <https://github.com/UiPath/Community.Activities/issues/43>
>
> \*\*Describe the bug\*\*
> If you import a function from another Python file and use …the Load Script activity, UiPath throws this exception: "ModuleNotFoundError : No module named 'to\_import'"
> 
> \*\*To Reproduce\*\*
> Steps to reproduce the behavior:
> 1. Create a Python file that imports and calls a function from another local Python file
> 2. Running that Python script through the command line works as expected
> 3. Running that same Python script through UiPath Load Script gives the above exception
> 
> \*\*Expected behavior\*\*
> It should import the function and run it without any problem, just like from the command line.
> 
> \*\*Additional context\*\*
> Example workflow here: https://drive.google.com/open?id=110ZaUyYRcYuUv5y6pvP0SKO8OcLgo2bw

For anyone looking for a workaround until this issue is fixed, you can do sys.path.append with a hard-coded reference to the project dir.

my\_python.py

```auto
import sys
sys.path.append('C:/Users/username/UiPath/project_folder')
import my_class

```

---

<div class="post-metadata">

**Author:** ![ibrahim\_stamili](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ibrahim_stamili/32/63779_2.png) [@ibrahim\_stamili](https://forum.uipath.com/u/ibrahim_stamili)\
**Post date:** [June 6, 2019, 12:19pm UTC](https://forum.uipath.com/t/python-source-file-cannot-be-found/105883/4 "2019-06-06T12:19:20Z")

</div>

Hello,

UIPath Rookie here. I am not sure if mine is a similar (or related) problem.

When using the Load Python Scripts Activity it fails whenever I have an _import statement_. I’m trying to import Pandas and BeautifulSoup. But it works fine when I remove them.

Kindly assist. Thanks.
