1

I have some code in such a way within a .py file let's call A.py:

from B import create_dummy_df, sqldf_function

a = create_dummy_df()

query = """
select *
from a
"""

b = sqldf_function(query)

Then in another .py file (I use pycharm) let's call B.py, I have the following function defined:

from pandasql import sqldf

sqldf_function(q: str):
    foo = sqldf(q.lower(), globals())
    return foo

What I don't understand is, if I try to execute A.py file, I get an error saying no such table a, but if I manually highlight and execute sqldf_function definition code block in B.py in console, then come back and try to execute b=sqldf_function(query) in A.py, it'll work. By the way I'm using python virtual environment console for these local executions.

Thank you all in advance.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.