I have registered some variable to store some value/string through def register()
in the __innit__.py
. And I wrote an operator in a separate file trying to access that variable, but fail.
In the __init__.py
I have register the following:
def register():
bpy.types.Scene.myVariable= "sometext"
import bpy
from bpy.types import Operator
from bpy.props import (
IntProperty,
FloatProperty,
StringProperty,
)
in the Operator file my_operators.py
I tried
import bpy
from bpy.types import Operator
from bpy.props import (
IntProperty,
FloatProperty,
StringProperty,
)
class MyOperator(bpy.types.Operator):
bl_idname = "myops.addthings"
bl_label = "Add Base Mesh"
bl_options = {'REGISTER', 'UNDO'}
bl_description ="Add Base Mesh"
#this line tries to get the registered variable
myVariable = bpy.context.scene.myVariable
def execute(self, context):
return {'FINISHED'}