title: Using Python to call MATLAB scripts in different directories results in Undefined function 'x'' for input arguments of type 'int64'
body: <p>Currently I am building a testing framework that uses MATLAB and Python scripts. I have one main script say 'MainFramework.py' that calls and passes arguments to a Class say 'MainClass_X.py' that calls and passes arguments to a function say 'x.py' that itself calls and passes arguments to 'x.m'.</p>
  <p>the MainFramework.py has the following format of code:</p>
  <pre><code>from MainClass_X import MainClass_X 
  arg1=&quot;something1&quot;
  arg2=&quot;something2&quot;
  Test=MainClass_X(arg1,arg2)
  Test.run() 
  </code></pre>
  <p>the MainClass_X.py has the following format of code:</p>
  <pre><code>from x import x
  class MainClass_X(object):
   def __init__(self,paramater1,parameter2):
     self.paramater1=paramater1
     self.paramater2=paramater2
   def run(self):
     x(self.paramater1,self.paramater2)
  </code></pre>
  <p>the function x.py has the following format of code:</p>
  <pre><code>import matlab.engine
  def x(arg1,arg2):
    eng=matlab.engine.start_matlab()
    eng.x(arg1,arg2,nargout=0)
  </code></pre>
  <p>When MainFramework.py, MainClass_X.py, x.py and x.m scripts are all in the same directory the scripts work as designed. However, as soon as I move MainFramework.py into a parent directory, the script gives me the following MATLAB error: Undefined function 'x'' for input arguments of type 'int64'.</p>
  <p>For better understanding, please find below the structure of the directories:</p>
  <pre><code>__directory1__
     MainFramework.py
  __directory1/subdirectory1__
     MainClass_X.py
     x.py
     x.m
  </code></pre>
  <p>I have double checked the path to make sure that MainFramework.py calls on the right MainClass_X.py, and I am sure that it does.</p>
  <p>I am using MATLAB 2020a and Python 3.7 and Anaconda3 and Spyder as an IDLE.</p>
  <p>Is there any way to get around this error. It is very important for the purpose of the task that the python scripts are in different directories.</p>