Create object problem on_startup

Hello!
I try to make a new plugin. I have done instructions from Plugin Tutorial. I have problem in creation an object. I used class from extra library, that tested befor.

init.py

def on_startup(self):
self._logger.info("Filament NFC ")
self.nfc = NFCmodule()

And in the octoprint.log I see this:

Traceback (most recent call last):
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/plugin/core.py", line 863, in _import_plugin
instance = imp.load_module(module_name, f, filename, description)
File "/home/pi/devel/OctoPrint-Filamentnfc/octoprint_FilamentNFC/init.py", line 13, in
octoprint.plugin.StartupPlugin):
File "/home/pi/devel/OctoPrint-Filamentnfc/octoprint_FilamentNFC/init.py", line 17, in FilamentnfcPlugin
self.nfc = NFCmodule()
NameError: name 'self' is not defined

I feel that it is very stuped error. I will be very grateful for the help.

Can you provide a formatted version of your __init__.py, and ideally the full file? Ideally throw it up on something like gist.github.com or pastebin.com.

My guess is that you have a simple indentation problem, causing your self.nfc line to be executed outside of the context of on_startup, e.g. you have something like this

class MyPlugin(octoprint.plugin.StartupPlugin):

    def on_startup(self):
        self._logger.info("Filament NFC")
    self.nfc = NFCmodule()

instead of this

class MyPlugin(octoprint.plugin.StartupPlugin):

    def on_startup(self):
        self._logger.info("Filament NFC")
        self.nfc = NFCmodule()

Python requires proper indentation.

Hello, Gina!

Thank you for reply. I have carefully changed all tabs to spaces and it works fine. I apologize for wasting your time because of the nonessential thing.