# Python mode tab loading issue

**URL:** <https://discourse.processing.org/t/python-mode-tab-loading-issue/46096>\
**Category:** Processing.py\
**Created:** [March 28, 2025, 7:35am UTC](https://discourse.processing.org/t/python-mode-tab-loading-issue/46096 "2025-03-28T07:35:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maumanto16](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@maumanto16](https://discourse.processing.org/u/maumanto16)\
**Post date:** [March 28, 2025, 7:35am UTC](https://discourse.processing.org/t/python-mode-tab-loading-issue/46096/1 "2025-03-28T07:35:16Z")

</div>

Hello.  
I have a very simple sketch with 2 tabs.

When i try to load a function from the second tab into my main tab it gives me:

NameError: global name ‘scene1’ is not defined

I tried debugging by making the codes as basic as possible, renaming the two tabs, and it still gives this error.

tried the same code translated in java and everything worked fine. Is this a known issue? Are there any fixes? Is there something i don’t know?

I work in processing 3.5.4 (because the newer version had other issues with python mode)

Thanks a lot

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [March 28, 2025, 5:58pm UTC](https://discourse.processing.org/t/python-mode-tab-loading-issue/46096/3 "2025-03-28T17:58:59Z")

</div>

> <https://github.com/jdf/Processing.py-Bugs/issues/395>
>
> When i try to load a function from the second tab in the main tab it gives me: 
> …
> NameError: global name 'scene1' is not defined
> 
> I tried debugging by making the codes as basic as possible, renaming the two tabs, and it still gives this error. 
> 
> tried the same code translated in java and everything worked fine. Is this a known issue? Are there any fixes?
> 
> I'm in processing 3.5.4 (because the newer version had other issues with python mode)
> 
> Thanks a lot

---

<div class="post-metadata">

**Author:** ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)\
**Post date:** [March 28, 2025, 8:24pm UTC](https://discourse.processing.org/t/python-mode-tab-loading-issue/46096/4 "2025-03-28T20:24:49Z")

</div>

On Python mode the tabs are like distinct modules, you need to import the names from them, it is not like on Java mode that the tabs behave like a single sketch.  
It should be something like this:

Main sketch window:

```python
from scenes import scene1, s

def setup():
    print(s)
    scene1()

```

scenes.py tab

```python
s = 10

def scene1():
    pass

```
