Modules In Pythonh

Hi,
Am Learning Python,
Can Anyone Help How To Import Module Created In One Folder Into Another Folder??

This is a really broad question, but maybe this simple example can help you understand how it works. Maybe you can try to continue playing with it, so you can provide more information to your use-case:

Take this structure for example

├── a
│ └── init.py
├── b
│ └── init.py
└── main.py

a defines a function called test, that prints test! once.
b on the other hand, import that function and defines test_twice calling the test function two times.
Then on the main.py I just call b function.
Here you can check the content of each file

# a/__init__.py
def test():
    print("test!")

# b/__init__.py
from a import test
def test_twice():
    test()
    test()

# main.py
from b import test_twice
test_twice()

Then you call main.py.
I hope it helps.

Hi Buddy
Thank Yu For Reply

I Have Query Abouy ** Operator

print(222) ==> 16

But print(222**2) ==> 65536

Can Yu Please Explain This?

First off, it’s a bit rude to “threadjack” a thread into an unrelated subject, even if you started the original thread. People interested in the question you raise won’t be able to find it easily. It’s a better idea to start a new thread with an appropriate title.

Second, since you haven’t marked up your code snippets as code, some of your code has been taken as mark-up. I’m guessing that you wanted to know why 2**2**2 is 16 and 2**2**2**2 is 65536. The answer is that unlike other operators, ** groups from right to left instead of left to right. In other words, Python breaks the expression down as 2**(2**(2**2)) -> 2**16 -> 65536. I suppose that is more in line with how we would write it as maths superscripts. Regardless, the operator precedence table is explicit that this is what happens.