Running python script in Blender

CyberShot picture CyberShot · Jul 23, 2012 · Viewed 73.7k times · Source

I installed Blender 2.6 and I'm trying to run a script called drawcar.py (Which uses PyOpenGL)

I looked around the documentation for importing a script and could only access Blender's python console.

How do I run drawcar.py from the Linux terminal with Blender?

Answer

Raunaq picture Raunaq · Oct 2, 2012

You can also execute the following code in the python console to execute an external script without opening it up in the text editor:

filename = "/full/path/to/myscript.py"
exec(compile(open(filename).read(), filename, 'exec'))

The above code comes from the following link:

Blender - Tips and Tricks