# Python access to FB variables

**URL:** https://www.finalbuilder.com/forums/t/python-access-to-fb-variables/1872
**Category:** Discussion
**Created:** [October 10, 2011, 4:33am UTC](https://www.finalbuilder.com/forums/t/python-access-to-fb-variables/1872 "2011-10-10T04:33:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [October 10, 2011, 4:33am UTC](https://www.finalbuilder.com/forums/t/python-access-to-fb-variables/1872/1 "2011-10-10T04:33:13Z")

</div>

Vincent,  
  
How does python script access FB variables?  
  
I defined a project variable varV1 and tried this simple script in an OnExecute handler:

```
the\_world\_is\_flat = 1  
if the\_world\_is\_flat:  
 print "Be careful not to fall off!" print varV1
```

but FB borks with error message:  
&nbsp;NameError: name 'varV1' is not defined  
  
Faithfully,  
Sean.  
&nbsp;

&nbsp;

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [October 10, 2011, 5:04am UTC](https://www.finalbuilder.com/forums/t/python-access-to-fb-variables/1872/2 "2011-10-10T05:04:53Z")

</div>

Python and Powershell are a bit different from the active script based languages, you have to use the FBVariables collection :   
  
 FBVariables[“SETME”] = “hello world”   
 print FBVariables[“SETME”]

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [October 10, 2011, 5:16am UTC](https://www.finalbuilder.com/forums/t/python-access-to-fb-variables/1872/3 "2011-10-10T05:16:34Z")

</div>

I see. Thanks.   
 You might want to update the chm help topic “Scripting in FinalBuilder”. The PowerShell case is mentioned in the help, but not the Python case.   
  
 Faithfully,   
 Sean
