# Questions regarding Mworks

**URL:** <https://mworks.discourse.group/t/questions-regarding-mworks/122>\
**Category:** Support\
**Created:** [July 6, 2021, 2:33pm UTC](https://mworks.discourse.group/t/questions-regarding-mworks/122 "2021-07-06T14:33:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 6, 2021, 2:33pm UTC](https://mworks.discourse.group/t/questions-regarding-mworks/122/1 "2021-07-06T14:33:18Z")

</div>

​Hi Chris,

My name is Suleman. I am a new grad student at the DiCarlo lab.

I am planning to run some stimulation experiments. I was wondering if I can send strings on a specified TCP port through mworks directly.

Alternatively, can I use the run\_python\_file action to send messages through python? In that case, how would I pass the command line arguments to the script?

Thank you for your help.

Best,  
Suleman

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 6, 2021, 2:47pm UTC](https://mworks.discourse.group/t/questions-regarding-mworks/122/2 "2021-07-06T14:47:35Z")

</div>

Hi Suleman,

> I was wondering if I can send strings on a specified TCP port through mworks directly.

No, that isn’t possible at present.

> Alternatively, can I use the run\_python\_file action to send messages through python?

Yes, you definitely can use Python to send messages via a TCP socket.

> In that case, how would I pass the command line arguments to the script?

Your Python code will run inside the MWServer process. To get data from your MWorks experiment to your Python code, you need to assign it to one or more MWorks [variables](https://mworks.github.io/documentation/latest/components/variable.html). Then, your Python code can use the `getvar` function to read the variables’ values and act accordingly. For more info on the MWorks-specific functions available to your Python code, see the documentation for [run\_python\_file](https://mworks.github.io/documentation/latest/components/run_python_file.html).

If you need further assistance, please let me know!

Cheers,  
Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 6, 2021, 3:01pm UTC](https://mworks.discourse.group/t/questions-regarding-mworks/122/3 "2021-07-06T15:01:43Z")

</div>

Hi Chris,

Thanks for the response. For now, I was able to set up my experiment. All python scripts being in the same workspace/scope worked as a feature for me as I needed to open one connection and keep it alive till the end of the protocol.

I hope there is no plan to change it anytime soon.

Best,  
Suleman

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 6, 2021, 3:46pm UTC](https://mworks.discourse.group/t/questions-regarding-mworks/122/4 "2021-07-06T15:46:37Z")

</div>

Hi Suleman,

> For now, I was able to set up my experiment.

Great!

> All python scripts being in the same workspace/scope worked as a feature for me as I needed to open one connection and keep it alive till the end of the protocol. I hope there is no plan to change it anytime soon.

It’s meant to work that way. I have no plans to change it.

Cheers,  
Chris

---

<div class="post-metadata">

**Author:** ![cstawarz](https://yyz1.discourse-cdn.com/flex031/user_avatar/mworks.discourse.group/cstawarz/32/3_2.png) [@cstawarz](https://mworks.discourse.group/u/cstawarz)\
**Post date:** [July 19, 2022, 7:05pm UTC](https://mworks.discourse.group/t/questions-regarding-mworks/122/5 "2022-07-19T19:05:54Z")

</div>


