JavaSa
JavaSa

Reputation: 6241

Calling static method

I'm trying to call a static method of a class from a different module and getting:

AttributeError: ClassObject instance has no attribute 'foo1'

Things are structures like this:
a.py file content:

class Conf():
    def __init__(self,......):
       .
       .
       .
    @staticmethod
    def foo1():
       .
       .
       .

b.py file content:

from a import Conf
Conf.foo1()

What am I doing wrong?

Upvotes: 0

Views: 368

Answers (1)

Arount
Arount

Reputation: 10403

You are calling your method in the good way, so maybe you are not importing the module.

Check which file is loaded as a.py in b.py:

import a
print a.__file__

This will print which file is loaded.

Upvotes: 1

Related Questions