Hello, am i missing something or is a bug ?

I made this script to show the problem.

So i can set the variable DO to 4 , for making a sequence of code run.

The same code is splitted , to be done if the DO is 1, 2,3…

The Task is to rotate 2 cubes , Rotating only 1

So quickly parent and unparent them.

If i run all the code in the script using DO = 4, the script will ignore some code

Running the Code 3 times, with DO=1, DO=2, DO=3 , will do all the action .

What i am missing?

```
import bpy
import math
from math import radians
import mathutils
from mathutils import Matrix, Euler, Quaternion , Vector
A=bpy.data.objects["AAA"]
B=bpy.data.objects["BBB"]
# set DO to 4 for doing all operations ......... Will not Rotate B
# set DO to ,1 and run, 2 and run... 3 and run ... Will rotate B too
DO=4
if DO == 1:
B.parent=A
B.matrix_parent_inverse = A.matrix_world.inverted()
if DO == 2:
EULER_WORLD = mathutils.Euler( (0, math.radians(15.0) ,0) ,'XYZ' )
A.rotation_euler.rotate( EULER_WORLD )
if DO == 3:
matrixcopy = B.matrix_world.copy()
B.parent=None
B.matrix_world = matrixcopy
if DO == 4:
B.parent=A
B.matrix_parent_inverse = A.matrix_world.inverted()
EULER_WORLD = mathutils.Euler( (0, math.radians(15.0) ,0) ,'XYZ' )
A.rotation_euler.rotate( EULER_WORLD )
matrixcopy = B.matrix_world.copy()
B.parent=None
B.matrix_world = matrixcopy
```