# Simple Python script to be able to change the number of samples in a Blender startup script

I have tried writing a simple script to set up de-noising and a render sample of 100 on Blender 2.93 with a simple cube animation.

bpy.context.scene.cycles.samples = 100


The reason is that we want to be able to quickly override the preset samples in .blend files that are uploaded on our server without having to reupload each time.

I've tried many different variations of this start-up script from many different forums, but the samples always remain how they are set in the file (in this case two samples)

 .\blender -P 100_samples.py -b "cube_animation.blend" -o "\001\####" -a


I tried following the advice here How to change render samples using python, but it is too complex a solution for what we need, and I can't extract the line(s) that are necessary.

.\blender -P 100_samples.py cube_animation.blend first runs the script, then opens the .blend file.
.\blender cube_animation.blend -P 100_samples.py first opens the .blend file, then runs the script.