# Using Fish Global variable into a Python script

**URL:** <https://forum.itascainternational.com/t/using-fish-global-variable-into-a-python-script/732>\
**Category:** FLAC3D\
**Tags:** python\
**Created:** [August 30, 2022, 6:49pm UTC](https://forum.itascainternational.com/t/using-fish-global-variable-into-a-python-script/732 "2022-08-30T18:49:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![puertame](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@puertame](https://forum.itascainternational.com/u/puertame)\
**Post date:** [August 30, 2022, 6:49pm UTC](https://forum.itascainternational.com/t/using-fish-global-variable-into-a-python-script/732/1 "2022-08-30T18:49:21Z")

</div>

Hello everyone,

Lets suppose that I created a FISH variable called A and stored a value equal to 100 in there. Which in FLAC3D would be written something like [A=100]. Then, would it be possible to use the previous in a Python "if " or “for” routine for further instructions to be made in FLAC3D?, something like this:

if it.command(“[A\>100]”):

```
it.command("model solve")

```

I’ve tried the above several times and by several ways, however I’ve been able to make it.

Can someone give me a hint on this?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![cheng](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@cheng](https://forum.itascainternational.com/u/cheng)\
**Post date:** [August 30, 2022, 8:27pm UTC](https://forum.itascainternational.com/t/using-fish-global-variable-into-a-python-script/732/2 "2022-08-30T20:27:18Z")

</div>

The Python variables and FISH variables are not directedly accessible, from or to. Use **itasca.fish.get** to read a FISH variable to Python, or use **itasca.fish.set** to set a variable into FISH.

Try:

A = it.fish.get(‘A’)  
if A \> 100:  
[space] it.command(“model solve”)

---

<div class="post-metadata">

**Author:** ![puertame](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@puertame](https://forum.itascainternational.com/u/puertame)\
**Post date:** [August 31, 2022, 4:43pm UTC](https://forum.itascainternational.com/t/using-fish-global-variable-into-a-python-script/732/3 "2022-08-31T16:43:03Z")

</div>

Hi Cheng!

I really appreciate your help. At the moment is working pretty well.
