From bpy.context import scene?

Hi, I just try some other ways to write code and import all sorts of modules from bpy.
like all of this:


from bpy.utils import register_class
from bpy.utils import unregister_class

from bpy import utils
from bpy.props import IntProperty
from bpy.props import CollectionProperty
from bpy.types import Scene
from bpy import context
from bpy import props

However…

This seem to doesn’t work the same way:

from bpy.context import scene

Is there any way to do this?

It works for just importing context from bpy…

I don’t think context allows import of context methods as modules, as context is dependent on which UI is active. Better to use bpy.context.scene directly. In your case, context.scene. You can also pass the current context in an operator class as an argument.

1 Like