Can I insert Python code into the scale of an object, to get a random width? I have created this:



And I want to randomize the width of the squares, so that there are different rectangles and not only squares... Is it possible to achieve this?

I'm not good at Python but I know something about coding and I think, that you can get a random Integer, using Python.
And is it than possible to use that code to randomize the width (Scale) of the rectangles?
Method: Animation Nodes
You can use Animation Nodes addon, add all the objects to a group, and use this simple node tree:

Method: Randomize Transforms
You can select the objects then use the operator: Object &gt;&gt; Transform &gt;&gt; Randomize Transform, or simply search for Randomize Transform:

Method: Python Script
Select the objects and run this simple script:

import bpy
import random

objects = bpy.context.selected_objects

for obj in objects:
    obj.scale.x = random.random() * 2


You mentioned that you are not experienced in python, Animation Node is like a visual scripting system that can be used to do anything, so I recommend you use it.