texnic
texnic

Reputation: 4098

Can I debug a module function in PyCharm Python console?

I have a module bar that defines a function foo. I can use PyCharm console to call this function:

import bar
bar.foo()

Is it possible to make PyCharm debug the code during such code, i.e. stop at breakpoints?

If it matters, I am using PyCharm on Windows.

Upvotes: 3

Views: 2340

Answers (1)

Eli
Eli

Reputation: 4926

In that case, you just need to define main function to call bar.foo():

import bar

if __name__ == '__main__':
    bar.foo()

Upvotes: 1

Related Questions