4
$\begingroup$

I have a .blend file and an accompanying python script that needs running very often when the .blend file is open.

As such, I wish to just "embed" the script into the text editor window. This way, I only need to save one .blend file instead of a .blend and a .py. The ideal startup window of the .blend file looks like this.

enter image description here

Can this be specified when I create this .blend file with Python?

$\endgroup$

2 Answers 2

2
$\begingroup$

Name the text datablock something.py and tick the 'register' checkbox. It'll run whenever you load the file, just like you want.

You do need to enable autorunning Python scripts in your user preferences (this is disabled by default for security reasons).

$\endgroup$
1
$\begingroup$

If you leave the script in that window and save the blend file it should be saved along with UI layout, on default saving settings at least.

$\endgroup$
3
  • $\begingroup$ I am creating this file in Python, not with GUI $\endgroup$ Commented Mar 31, 2017 at 16:29
  • $\begingroup$ You took a picture of it. The file is loaded in Blender. It is in the GUI. $\endgroup$
    – D. Skarn
    Commented Mar 31, 2017 at 18:15
  • $\begingroup$ "The ideal startup window of the .blend file [created with Python] looks like this." $\endgroup$ Commented Mar 31, 2017 at 18:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .