Import local function from module, cpu goes to 100%

Hi guys,
I need your help about a weird behavior when running streamlit app.
my streamlit app structure is app.py and utils a package of helper modules.
Whenver I import a function from a module in utils package my ec2 cpu goes to 100% whatever the thing i am importing. But when implement the same function in app.py cpu is 0.1%

Here is linux top command when calling function from app.py:

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                         

10274 ubuntu 20 0 32.0g 594176 25344 S 8.0 7.4 10:21.19 node

here is the cpu using when calling the function from utils.module1:

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                         

47579 ubuntu 20 0 4308864 541540 199040 S 109.6 6.8 0:09.37 streamlit

details about this application:

  1. utils package:
    init.py
    module1.py
    module2.py

a- init.py:
from . import module1
all = [‘module1’, module2’]

utils.module:

def function1()
return “this is function1”

import streamlit as st
from utils.module import function1

st.write(function1)

Thanks in advance.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.