# RV python interpreter

**URL:** <https://community.shotgridsoftware.com/t/rv-python-interpreter/16680>\
**Category:** RV\
**Created:** [January 25, 2023, 2:58am UTC](https://community.shotgridsoftware.com/t/rv-python-interpreter/16680 "2023-01-25T02:58:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiffjaff](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@jiffjaff](https://community.shotgridsoftware.com/u/jiffjaff)\
**Post date:** [January 25, 2023, 2:58am UTC](https://community.shotgridsoftware.com/t/rv-python-interpreter/16680/1 "2023-01-25T02:58:53Z")

</div>

I have a python script that’s working well when I test it from the ShotGrid Python Console within RV. But I would like to run the script externally. I thought that the python interpreter would do the trick (/Applications/RV.app/Contents/MacOS/py-interp) but it can’t import the rv.commands module:

import rv.commands as rvc

ModuleNotFoundError: No module named ‘rv.commands’

Any advice? Thanks!

---

<div class="post-metadata">

**Author:** ![bernie](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/bernie/32/1717_2.png) [@bernie](https://community.shotgridsoftware.com/u/bernie)\
**Post date:** [January 25, 2023, 1:30pm UTC](https://community.shotgridsoftware.com/t/rv-python-interpreter/16680/2 "2023-01-25T13:30:21Z")

</div>

You could use the -pyeval RV command line option to execute your script:

```auto
/Applications/RV.app/Contents/MacOS/RV -pyeval "from rv import commands;commands.addSourceVerbose(['syncflash,start=1,end=500,interval=1,fps=24.movieproc']) "

```

Alternatively you could also have your code executed as part of a python package in RV:  
**[How do I write my first package in RV?](https://community.shotgridsoftware.com/t/how-do-i-write-my-first-package-in-rv/96)**

I hope this helps,

Bernie

---

<div class="post-metadata">

**Author:** ![jiffjaff](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@jiffjaff](https://community.shotgridsoftware.com/u/jiffjaff)\
**Post date:** [January 25, 2023, 10:29pm UTC](https://community.shotgridsoftware.com/t/rv-python-interpreter/16680/3 "2023-01-25T22:29:44Z")

</div>

Hi Bernie. These are helpful suggestions that I can play around with. But ultimately I don’t think exactly what I’m looking for.

To give more context, the script I’m writing is a custom RV session build to be launched from ShotGrid. Select your versions, click a button, and then the script will build an RV session with the files stacked with old versions, plates, etc.

So it’s a long enough script that embedding it in a pyeval command seems odd. The package suggestion could work, but that would mean the user would click a button in ShotGrid that would prep an input file somewhere, then click a button in RV to actually ingest said input file. Two clicks ain’t the end of the world, but it doesn’t feel like the ideal design.

I guess I just figured I was missing a path to a true python interpreter that has all of RV’s modules included. It seems to me like this desire to access the rv.commands module to prep a session externally would be relatively common.

So, still looking for input if there are any suggestions. But in the meantime, will use one of the options that you suggested.

Thanks!

---

<div class="post-metadata">

**Author:** ![Ricardo\_Musch](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/ricardo_musch/32/405_2.png) [@Ricardo\_Musch](https://community.shotgridsoftware.com/u/Ricardo_Musch)\
**Post date:** [January 26, 2023, 12:38pm UTC](https://community.shotgridsoftware.com/t/rv-python-interpreter/16680/4 "2023-01-26T12:38:03Z")

</div>

Use pyeval to import a python script and run it?  
That would be a few lines only.

---

<div class="post-metadata">

**Author:** ![Ricardo\_Musch](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/ricardo_musch/32/405_2.png) [@Ricardo\_Musch](https://community.shotgridsoftware.com/u/Ricardo_Musch)\
**Post date:** [January 26, 2023, 12:39pm UTC](https://community.shotgridsoftware.com/t/rv-python-interpreter/16680/5 "2023-01-26T12:39:14Z")

</div>

You can also alter the `rvlink://` uri handler btw.

> **[RVLink URLs: RV as protocol handler | ShotGrid | Autodesk Knowledge Network](https://knowledge.autodesk.com/support/shotgrid/learn-explore/caas/CloudHelp/cloudhelp/ENU/SG-RV/files/rv-knowledge-base/SG-RV-rv-knowledge-base-rv-link-urls-html-html.html)**
>
> RV can act as a protocol handler for URLs using the "rvlink" protocol. These URLs have the form: rvlink:// For example, rvlink:// -l -play /path/to/my/movie.mov will start RV (or on the mac, create a new session or replace the current session),...
