If you could try stripping down your code example to the relevant motion parts, it would be much easier for others to help diagnosing your problems.
Also, please post code inside a code block:
```python
def my_function():
return 0
```
which results in
def my_function():
return 0