there are many examples of staticmethod in a class with caller in one file. this works fine. but i have tried to save the class with staticmethod in a single file and import it from caller. this then throws the error "AttributeError: 'module' object has no attribute methodname"
i am using python2.7. used exact example from Static methods in Python?
import MyClass
# belwo class is saved in a saparate file named MyClass.py
# class MyClass(object):
# @staticmethod
# def the_static_method(x):
# print(x)
MyClass.the_static_method(2) # outputs 2
# if via import, we have the error: AttributeError: 'module' object has no attribute 'the_static_method'