Panel.draw() and external objects

Hallo,

I try to acces external objects in the draw() function of a selfmade panel.
However when I do so all those objects except Operators are set to ‘None’.

The following code will thus give an error:


import bpy

class a():
    @classmethod
    def methodA():
        print("a")
        
class b(bpy.types.Panel):
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_label = 'test'
    
    def draw(self,context):
        a.methodA()

that ‘NoneType’ does not have the methodA

Does anyone have the same problem and solved it?
My Blender version is: 2.53.1 r318127
many thanks


import bpy

class a():
    def methodA(self):
        print("a")
        
class b(bpy.types.Panel):
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_label = 'test'
    
    @classmethod
    def poll(self,context):
        return True
    
    def draw(self, context):
        a().methodA()

Vista, SVN 31853
If you add the decorator: @classmethod
change your code to:



class a():
    @classmethod
    def methodA(<b>self</b>):
        print("a")
        
class b(bpy.types.Panel):
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_label = 'test'
    
    def draw(self,context):
        a.methodA()

I had the same problem with r31827, but I just updated to r31880 and the issue seems fixed there.

@Uncle Entity & PKHG
Both solutions still give the same problem:
AttributeError: ‘NoneType’ object has no attribute ‘methodA’

@gibberisch
I recently updated blender to 2.54.0 r31896
The problem is solved on the laptop of a friend of mine who runs ubuntu.
But on my own laptop, a macbook with leopard, the problem persists.

import bpy #should be added in front of my example

Vista W32 SVN31894, no problem, prints a lot of ‘a’ …

yh I did test it with the import.
It seems that the error is only on OS X. I think I will work on a virtual machine until they fixe it.