Python not importing module from same directory

Question:

They are in the same directory and I have the path set to the correct folder so I have no idea why it can’t find the python file

Expecting it to open the file to access a class.

Code is as follows:

import pandas as pd

import os

print("Working dir:", os.getcwd())

import OfficeContextAgent

Answers:

Make sure that you name the file OfficeContextAgent.py and not just OfficeContextAgent. Python modules end in .py [ docs.python.org entry on modules ]

Answered By: Naum Raskind
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.