I have a module named SSFbasis.py containing a function named SSFBasisFunc which looks like this:
if __name__ == '__main__':
def SSFBasisFunc():
import os
import re
from pandas import ExcelWriter
......... etc.
I then have a MainScript.py where I have
import SSFBasis
a = SSFBasis.SSFBasisFunc()
and I get the error AttributeError: module 'SSFBasis' has no attribute 'SSFBasisFunc'.
Now, as I understand it, the name=main part in my function should prevent the code being executed on the initial import statement -- indeed this is what I want to happen.
But given I am then explicitly calling the function, shouldn't it be fine recognising the function, or am I misunderstanding the name == 'main': ?
** I am doing this using Spyder and Python 3.7 **