test.py I have the following line. It was taken from this page:
Then I start blender from the bash prompt:
blender Rigged\ Hand.blend --python test.py
The response on the terminal:
Traceback (most recent call last): File "/home/sam/proj/Rigged Hand/a/setup.py", line 1, in <module> bpy.data.objects NameError: name 'bpy' is not defined
Even though blender has opened my file, I can open the python prompt inside blender and type the same thing; I get the response
<bpy_collection, BlendDataObjects> as expected.
Why can I not use bpy in the script which I invoked from the command line?